GD-Library and very large images.

From: Date: Thu, 05 Jul 2001 01:25:18 +0000
Subject: GD-Library and very large images.
Groups: php.windows 
Request: Send a blank email to php-windows+get-8123@lists.php.net to get a copy of this message
I use the following simple script to resize large images (typically 4000x4000 pixels and up). After upgrading to PHP 4.06, and the GD- Library bundled with that release, the result images become either yellow or black (seems to be dependant on what kind of image), when the source image is wider than 2048 pixels. <?php $size = getImageSize($imgfile); if ((!$x)|| (!$y)) { $x = $size[0]; $y = $size[1]; } switch ($size[2]) { case 2: $in_img = ImageCreateFromJpeg($imgfile); $out_format = 1; break; case 3: $in_img = ImageCreateFromPng($imgfile); $out_format = 2; break; default: die("File is not jpg or png. Terminating"); } $out_img = ImageCreate($x,$y); $color = ImageColorAllocate($out_img,255,255,255); imagecolortransparent($out_img, $color); ImageCopyResized($out_img, $in_img, 0, 0, 0, 0, $x, $y, $size[0], $size[1]); switch ($out_format) { case 1: header ("Content-type: image/jpeg"); ImageJPEG($out_img); case 2: header ("Content-type: image/png"); ImagePNG($out_img); default: die("should never happen"); } ?> I am wondering whether there is something wrong with my script, or with GD-library. I am running Apache 1.3.20r2 and PHP4.06 on Windows 2000 Professional -- Arve «The pessimist sees difficulty in every opportunity. The optimist sees opportunity in every difficulty.» - Winston Churchill http://www.bersvendsen.com/

« previous php.windows (#8123) next »