ON our site I think I'm going to switch to Jpeg output from PNG24.&nbsp; 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.&nbsp; 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.&nbsp; 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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case &quot;JPEG&quot;:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $GLOBALS['szMapImageFormat'] = 'JPEG'; //mapscript format name
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $GLOBALS['szImageQuality'] = '90'; //mapscript image quality, only applies to jpeg images<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $GLOBALS['szMapImageCreateFunction'] = &quot;imagecreatefromjpeg&quot;; // appropriate GD function<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $GLOBALS['szImageExtension'] = '.jpg'; //file extension<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $GLOBALS['szImageCreateFunction'] = &quot;imagecreatetruecolor&quot;; //or imagecreatetruecolor if PNG24 ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $GLOBALS['szImageOutputFunction'] = &quot;imagejpeg&quot;; //or imagegif, imagejpeg ...
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $GLOBALS['szImageHeader'] = 'image/jpeg'; //the content-type of the image&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if($szImageQuality){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; eval(&quot;$szImageOutputFunction( \$oTile, '&quot;.$szTileImg.&quot;', '&quot;.$szImageQuality.&quot;');&quot;); <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }else{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; eval(&quot;$szImageOutputFunction( \$oTile, '&quot;.$szTileImg.&quot;');&quot;); 
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }</blockquote><div><br>The code is pretty self explanatory.&nbsp; 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>