[mapserver-users] PHP $imgObj->saveImage(null) sends headers

Miloslav Kmeť miloslav.kmet at gmail.com
Mon Apr 5 13:21:49 EDT 2010


Hi. I am trying to use php_mapscript in MVC framework (symfony) and I want to 
catch the output of $imgObje->saveImage(null); for the later processing, eg: 
using the builtin cache mechanism instead of directly writing the file to the 
cache.

My code very simplified looks like:

ob_start();                            // start output buffering
$imgObj->saveImage(null);  // print output to std
$image = ob_get_clean();   // get the buffer and clen it

header('Content-type: image/jpeg'); // setting the header
echo $image; // printing the image

At the header line I got an header already sended error, even no output will 
be brinted before.

I looked into php_mapscript.c and I found that in the saveImage function there 
is php_header(TSRMLS_C); As I do not know the PHP internals, i do not know 
what that call is doing, but when I removed it out, and recompiled the 
extension,

Now output buffering is working correctly.

What is the function doing? Should it be replaced in the main development?

Thanks
-- 
Miloslav Kmeť
-------------- next part --------------
A non-text attachment was scrubbed...
Name: php_mapscript.patch
Type: text/x-patch
Size: 509 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100405/2330f9e6/php_mapscript.bin


More information about the mapserver-users mailing list