WMS ms_iostripstdoutbuffercontenttype() question

Frank Warmerdam warmerdam at POBOX.COM
Sat Apr 7 11:11:37 EDT 2007


Jorge de Jesus wrote:
> Hi
> 
> This is probably a newbie question:
> 
> I am working with the WxS wrapper script found in the mapserver site and
> the final part of the script is the HTTP header reply and dumping of the
> image is:
> 
> $contenttype = ms_iostripstdoutbuffercontenttype();
> header('Content-type: image/png');
> ms_iogetStdoutBufferBytes();
> ms_ioresethandlers();
> 
> since the header() already defines the content-type I was thinking that
> the $contenttype was not necessary so I removed the $contenttype and got
> an error message  which is not a string but an image.If I do
> header('Content-type: $contenttype); everything also works fine.
> 
> Why is mandatory to have $contenttype =
> ms_iostripstdoutbuffercontenttype(); ?!

Jorge,

This is necessary because until you call ms_iostripstdoutbuffercontenttype()
the content type string is still in the stdout buffer, and will get dumped
along with it when you call ms_iogetStdoutBufferBytes().

The ms_iostripstdoutbuffercontenttype() *strip* it out of the stdout
buffer as well as returning it to you.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list