[mapserver-users] MS_PNG or MS_JPEG

Daniel Morissette morissette at dmsolutions.ca
Tue Jul 31 13:09:07 PDT 2001


> Jim Burnett wrote:
> 
> MS_PNG or MS_JPEG
> 
> int saveImage(string filename, int type, int transparent, int
> interlace,
>                  int quality)
>         Writes image object to specifed filename.
>         Passing an empty filename sends output to stdout.  In this
> case,
>         the PHP header() function should be used to set the
> documents's
>         content-type prior to calling saveImage().
>         Type can be either MS_PNG or MS_JPEG
>         Quality should be a value in the range 0-95, higher value
> implies
>         higher image quality and larger image sizes.
>         If quality is negative, then the default IJG JPEG quality
> value is
>         used.
>         The function returns -1 on error.  On success, it returns
> either 0
>         if writing to an external file, or the number of bytes written
> if
>         output is sent to stdout.
> 
> no GIF support?
> 


The documentation you quoted was from MapServer 3.4 ... in that version,
the saveImage() function had 2 possible forms depending on which GD you
compiled with.  So to answer your question, no there was no GIF support
when using GD 1.8 but if you comiled MapServer with older versions of GD
(1.2, 1.3 at least) then you could still use GIF (see
http://www2.dmsolutions.ca/mapserver/php_mapscript/php_mapscript_docs.html):

------
 With GD 1.2, 1.3, 1.6:

   int saveImage(string filename, int transparent, int interlace)

 With GD 1.8 (only if JPEG enabled in GD 1.8):

   int saveImage(string filename, int type, int transparent, 
                 int interlace, int quality)

------


In MapServer 3.5, there is only one version of the saveImage() call
which supports all the formats that your GD lib supports (see
http://www2.dmsolutions.ca/mapserver/php_mapscript/php_mapscript_docs35.html):

------
int saveImage(string filename, int type, int transparent, int interlace, 
                 int quality)
        Writes image object to specifed filename.
        Passing an empty filename sends output to stdout.  In this case,
        the PHP header() function should be used to set the documents's
        content-type prior to calling saveImage().
        Type can be either MS_GIF, MS_PNG, MS_JPEG or MS_WBMP (depends
on
        which version of GD was used to compile MapScript)
        Quality should be a value in the range 0-95, higher value
implies
        higher image quality and larger image sizes.
        If quality is negative, then the default IJG JPEG quality value
        is used (the quality value is ignored for all formats other than
        JPEG).
        The function returns -1 on error.  On success, it returns either
        0 if writing to an external file, or the number of bytes written
        if output is sent to stdout.
------

Note that you can also get a patched GD1.8.4 that supports GIF and will
work with MapServer 3.5 ... as long as you're aware of the Unisys patent
issues of course!  ;)
-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.



More information about the MapServer-users mailing list