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.<br><br>
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:
<br><br>Config.php<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"> case "JPEG":<br> $GLOBALS['szMapImageFormat'] = 'JPEG'; //mapscript format name
<br> $GLOBALS['szImageQuality'] = '90'; //mapscript image quality, only applies to jpeg images<br> $GLOBALS['szMapImageCreateFunction'] = "imagecreatefromjpeg"; // appropriate GD function<br>
$GLOBALS['szImageExtension'] = '.jpg'; //file extension<br> $GLOBALS['szImageCreateFunction'] = "imagecreatetruecolor"; //or imagecreatetruecolor if PNG24 ...<br> $GLOBALS['szImageOutputFunction'] = "imagejpeg"; //or imagegif, imagejpeg ...
<br> $GLOBALS['szImageHeader'] = 'image/jpeg'; //the content-type of the image <br> break;</blockquote><div><br>tile.php<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
if($szImageQuality){<br> eval("$szImageOutputFunction( \$oTile, '".$szTileImg."', '".$szImageQuality."');"); <br> }else{<br> eval("$szImageOutputFunction( \$oTile, '".$szTileImg."');");
<br> }</blockquote><div><br>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.<br>
<br>BTW, I'm using version .2 (from CVS at that time) so I'm not sure if this has been added since.<br><br>Thanks!<br></div></div>-- <br>Clark Endrizzi<br>