[Mapserver-users] mode=map with PHP/Mapscript
William A. Bronsema, C.E.T.
bronsema at dmsolutions.ca
Wed Jul 16 04:20:47 PDT 2003
John,
You can output the map image directly to stdout by using the saveImage()
function call on a map image object.
In order to call this directly from an image tag I typically call a php
page dedicated to drawing the map image and returning it to stdout.
For example:
Create a page (called drawmap.php or whatever you like) to draw the map:
<?php
....open mapfile etc.
// draw the map
$oImage = $oMap->draw();
// set the page header
header("Content-type: image/png");
// output the image to stdout (using mapscript 4.0)
$url = $oImage->saveImage("");
?>
Then in my main page call the following image tag:
<img src="./drawmap.php" width=400 height=300>
That should do it for you. Note: the saveImage function call requires
parameters to be passed for Mapscript 3.6
(http://mapserver.gis.umn.edu/doc36/phpmapscript-class-guide.html#ImageObj
for reference).
Regards,
Bill
John Hagstrand wrote:
> Hello,
>
> I use mapserv cgi with mode=map to return the image directly into the <img>
> tag. Now I'm considering using PHP/Mapscript, but in looking at the
> examples, they all seem to use the saveImage() or saveWebImage() function to
> save the image to a file. Is it possible to return the image directly
> into the <img> tag using mode=map when using PHP/Mapscript?
>
> Thanks
> John
>
> John Hagstrand
> Interage Research, Inc.
> 18733 State Line Road
> Antioch, IL 60002
> 847 838 5371
>
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
--
William A. Bronsema, C.E.T.
Applications Developer
DM Solutions Group Inc.
http://www.dmsolutions.ca
e-mail: bronsema at dmsolutions.ca
phone : +1 (613) 565-5056 ext.25
fax : +1 (613) 565-0925
_______________________________________________
More information about the MapServer-users
mailing list