From: [EMAIL PROTECTED]
Operating system: Linux
PHP version: 4.2.3
PHP Bug Type: GD related
Bug description: Jpeg colors change
Resized images generated from jpg files displaying botched or dimmed colors
after update from 4.2.2 to 4.2.3.
Example code:
# get the data from the original, large image
$src_img = ImageCreateFromJPEG($image);
# create new image
$dst_img = ImageCreate($new_w,$new_h);
# allocate colors for background and border
$mattecolor = ImageColorAllocate($dst_img,$mr,$mg,$mb);
$bordercolor = ImageColorAllocate($dst_img,$br,$bg,$bb);
# fill image with matte color
ImageFill($dst_img,0,0,$mattecolor);
# resize source image and place the copy in the destination image
ImageCopyResized($dst_img,$src_img,
$margin_x,$margin_y,
0,0,$thumb_w,$thumb_h,
$old_x,$old_y);
# if there is a border set, draw a rectangle around the thumbnail
if
($border==1){imageRectangle($dst_img,0,0,$new_w-1,$new_h-1,$bordercolor);}
# create final image and free up the memory
ImageJPEG($dst_img);
ImageDestroy($dst_img);
--
Edit bug report at http://bugs.php.net/?id=20443&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20443&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20443&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20443&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20443&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20443&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20443&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20443&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20443&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20443&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20443&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20443&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20443&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20443&r=isapi