#21265 [Ver->Bgs]: unexpected low color depth

From: Date: Sun, 29 Dec 2002 19:13:39 +0000
Subject: #21265 [Ver->Bgs]: unexpected low color depth
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-28691@lists.php.net to get a copy of this message
ID: 21265 Updated by: iliaa@php.net Reported By: tho.r@gmx.net -Status: Verified +Status: Bogus Bug Type: GD related Operating System: Linux PHP Version: 4.3.0/4.4.0 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The image you are making a thumbnail is a truecolor image, therefor when creating the thumbnail, you should use imagecreatetruecolor() & not imagecreate(). Previous Comments: ------------------------------------------------------------------------ [2002-12-29 09:25:41] tho.r@gmx.net Hi! Before switching to PHP 4.3.0 we could create a "nice" colored thumbnail from an image via PHP and GD (1.8.x) with the following code: $thumb = imagecreate($twidth, $theight); $orig = @imagecreatefromjpeg($file); if (!$orig) { echo "Couldn't load JPEG image '$file'."; exit(); } imagecopyresized($thumb, $orig, 0, 0, 0, 0, $twidth, $theight, $width, $height); mkdir(dirname($thumbnail),0777); imagejpeg($thumb,$thumbnail,65); We had a switch statement for any supported image type (JPEG, GIF and PNG). The created image is of course smaller but has the same color depth as the original. After using PHP 4.3.0 and its bundled GD2 library the image is also created but the result has very less colors (maybe 16). I've put an example here: http://thoralf.log-out.net/tmp/php4.3.0.html I'm not sure, if I did a mistake or if there is something missing now - but it works with PHP4.2.2 very well. The PHPInfo from the server can be found here: http://m84.de/phpinfo.php bye Thoralf ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21265&edit=1

« previous php.bugs (#28691) next »