[mapserver-users] New perl mapscript doc Error?

Doug Williams williams at wildweb.org
Tue Feb 26 01:30:31 EST 2002


Nuno,

Indeed, the new perl documentation needs some miscellaneous fixes...

The proper way to save an image does utilize 6 parameters, as you indicate.
Try:
$legend = $map->drawLegend() or die('Unable to draw map');
$legendfile = "/path/to/web/imagedir/legendexample.png";
$legendurl = "/web/imagedir/legendexample.png";
mapscript::msSaveImage($legend, $legendfile, 2, 1, 1, 95);

The new parameters are for type of image (png, etc) and image quality (ignored unless jpg) - I think.
The order is (image, image_file, image_type, transparent, interlace, quality)

I'm guessing at the value 2 for image type.  I'm making PNGs.  The value 1 worked also. 
0 and 4 did not work for png, did not try jpg. 
The PHP documentation has mapserver constants that define the image types.
You might find somethng useful there.
I found the parameters for the above msSaveImage() listed in my web server 
error log when using the incorrectly listed paprameters.  Note: interlace and 
transparent are listed backwards in the 3.3 documentation.

Good Luck.


On Thursday 21 February 2002 10:45, Nuno Alves wrote:
> Hi all,
>
> We can see in the new mapscript documentation the following example, but i
> think it is wrong:
> the msSaveImage function has now new parameters (six), or am i wrong. This
> is the example of
> the perl mapscript 3.3.
>
> #!/usr/bin/perl
> use mapscript;
> $map = new mapObj('example.map) or die('Unable to open mapfile.');
> $img = $map->draw() or die('Unable to draw map');
> mapscript::msSaveImage($img, 'example.gif', $map->{interlace},
> $map->{transparent});
>
> I also would like to know if it will be posted a "perl mapscript by example
> how-to" like in php documentation.
>
> Thanks in advance,
>
>  <<...OLE_Obj...>>
>
> Nuno Ricardo Ribeiro Alves
> PT Inovação, S.A.
> Serviços e Redes Móveis
> * R. Engº José Ferreira Pinto Basto - 3810 Aveiro
> * mailto:est-n-alves at ptinovacao.pt



More information about the mapserver-users mailing list