Hi Vassilis,
You are missing after the draw() the following:
//send image to stdout (browser), without saving file locally
echo $oImage ->getBytes();
I also prefer to set the header right before that getBytes() call.
For a full working example, you can use the quickmap.php file that is
included in MS4W (see /ms4w/Apache/htdocs/quickmap.php) from
https://ms4w.com
Hope that helps,
-jeff
--
Jeff McKenna
GatewayGeo: Developers of MS4W, & offering MapServer Consulting/Dev
co-founder of FOSS4G
http://gatewaygeo.com/
On 2023-10-26 7:25 a.m., Vassilis Chatzigiannakis via MapServer-users wrote:
Dear all,
We are using Mapserver 8.0.1 with PHP and the php_mapscriptng extension.
I am having a hard time outputting the image to the browser.
In the following code snippet, saving to disk works but
mapscript.imageObj.write does not output the image in the browser.
header('Content-type: image/png');
$oImg=$oMap->draw();
$oImg->save("/tmp/mswms.png");
$oImg->write();
Do you have a working PHP example of
https://mapserver.org/mapscript/mapscript-api/stub/mapscript.imageObj.html#mapscript.imageObj.write <https://mapserver.org/mapscript/mapscript-api/stub/mapscript.imageObj.html#mapscript.imageObj.write>?
Or is there another way of showing the image in the browser?
Best regards,
Vassilis
_______________________________________________
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users