Hi,

The script below functioned correctly, but I guess my host updated php and now I've got a problem using PHP/ImageCreateFromJPEG(), it looks like this function now returns a 16 color image instead of the fullcolor original.

Does this sound formilior (?? excuse my english)

See these links for an example
Original image: http://www.achterdeheuvel.nl/foto/2002/week1/2002_1_081.jpg
With script: http://www.achterdeheuvel.nl/resize.php?dir=foto/2002/week1&pic=2002_1_081&w=610&h=407

========================================

== PHP Script used

<?php 
/* 
Script for image rescaling, version 1.0 
(C) Z. Wagner -- Ice Bear Soft, 2002 
[url]http://icebearsoft.euweb.cz[/url] 

The script was prepared for photo galleries at 
[url]http://icebearsoft.euweb.cz/photo.html[/url] 

This PHP script is free software. Its use and distribution should follow 
the General Public Licence (see [url]http://www.gnu.org[/url]). Since this licence 
is void in the Czech Republic, the users may opt to use a modified version 
available from [url]http://www.zastudena.cz[/url] 

You can find more information on [url]http://icebearsoft.euweb.cz/czgpl/[/url] 
*/ 

if (!$dir || !$pic || !$w || !$h) die(); 
if (!preg_match('/\d+/', $w)) die(); 
if (!preg_match('/\d+/', $h)) die(); 
if ($h < 10 || $w < 10) die(); 
header('Content-Type: image/jpeg'); 
if ($REQUEST_METHOD != 'GET') exit; 
$src = ImageCreateFromJPEG("$dir/$pic.jpg"); 
if ($src) { 
  $size = GetImageSize("$dir/$pic.jpg"); 
  $img = ImageCreate($w, $h); 
  ImageCopyResized($img, $src, 0, 0, 0, 0, $w, $h, $size[0], $size[1]); 
  ImageJPEG($img); 
} 
?> 

    The feedback forum is for feedback on the forums, not for PHP programming help; there are other forums for that and this question should really be ask there. But to suggest an answer here; your host may well be using GDLib2 - if you upgrade your script to use the truecolor functions (and imagecreateresampled() instead of imagecreateresized()) instead of the palette-based ones you're using now the resulting images will not only be better than they are now but better than they were on the old host (which if you look closely at them were not full-colour but only used 256 colours).

      May i state that script doesnt look like its come from the PHPBuilder site articles. Like Weedpacket said there are other forums.

      Strike there is a difference between the photos as well

        Thought this was something with which the PHP-dev could answer, becouse of the version update of PHP.

        Sorry for starting this tread in the wrong forum. Thx anyway for your advice... if this does not cure the problem i'll continue this tread in a develop/program forum.

        BTW.. how can i close this tread?

          Write a Reply...