[ka-Map-users] Simply modification to allow compression settings for jpeg output

Clark Endrizzi cendrizzi at gmail.com
Tue May 16 09:34:35 EDT 2006


Thanks guys.  Apparently my solution was completely worthless.  I had no
idea you could do different formats per layer.  That's perfect.

Thanks,
Clark

On 5/15/06, Paul Spencer <pspencer at dmsolutions.ca> wrote:
>
> Clark,
>
> you can also just declare an appropriate outputformat object in your
> map file named JPEG.  tile.php simply selects the output format.  If
> you don't have one defined in your map file, you get the defaults.
> If you do ... :)
>
> Cheers
>
> Paul
>
> On 15-May-06, at 1:09 PM, Clark Endrizzi wrote:
>
> > ON our site I think I'm going to switch to Jpeg output from PNG24.
> > I like PNG24 more without a doubt but the Jpeg images are about 1/4
> > the size (I'm using aerial imagery) so it will be a lot better
> > bandwidth-wise.
> >
> > The problem I saw with using jpeg is it uses GD's default JPEG
> > settings which is about 75% quality.  Shape files like streets look
> > terrible at this quality setting so I quickly added a little bit to
> > make it possible for the user to define their own compression.
> > Here is the code:
> >
> > Config.php
> >         case "JPEG":
> >             $GLOBALS['szMapImageFormat'] = 'JPEG'; //mapscript
> > format name
> >             $GLOBALS['szImageQuality'] = '90'; //mapscript image
> > quality, only applies to jpeg images
> >             $GLOBALS['szMapImageCreateFunction'] =
> > "imagecreatefromjpeg"; // appropriate GD function
> >             $GLOBALS['szImageExtension'] = '.jpg'; //file extension
> >             $GLOBALS['szImageCreateFunction'] =
> > "imagecreatetruecolor"; //or imagecreatetruecolor if PNG24 ...
> >             $GLOBALS['szImageOutputFunction'] = "imagejpeg"; //or
> > imagegif, imagejpeg ...
> >             $GLOBALS['szImageHeader'] = 'image/jpeg'; //the content-
> > type of the image
> >             break;
> >
> > tile.php
> >             if($szImageQuality){
> >                 eval("$szImageOutputFunction( \$oTile, '".
> > $szTileImg."', '".$szImageQuality."');");
> >             }else{
> >                 eval("$szImageOutputFunction( \$oTile, '".
> > $szTileImg."');");
> >             }
> >
> > The code is pretty self explanatory.  I don't know if this project
> > would consider this addition but I think it's important for users
> > to be able to define image quality for jpegs.
> >
> > BTW, I'm using version .2 (from CVS at that time) so I'm not sure
> > if this has been added since.
> >
> > Thanks!
> > --
> > Clark Endrizzi
> > _______________________________________________
> > ka-Map-users mailing list
> > ka-Map-users at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/ka-map-users
>
> +-----------------------------------------------------------------+
> |Paul Spencer                           pspencer at dmsolutions.ca   |
> +-----------------------------------------------------------------+
> |Applications & Software Development                              |
> |DM Solutions Group Inc                 http://www.dmsolutions.ca/|
> +-----------------------------------------------------------------+
>
>
>
>
>


-- 
Clark Endrizzi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20060516/d119ca99/attachment-0001.html


More information about the ka-Map-users mailing list