Hi all! I currently have PHP Version 4.3.1 and GD Version 2.0.11 up and runing. When I'm rtying to ImageCreateFromJPEG and creatre a PNG thumbnail of that image I get result in 256 colors (I guess) - it looks ugly. When I roll back to GD Version 1.8.4 everything works fine - thumbnails are TrueColor images. People say that imagecreatetruecolor() solves the problem. But in my case ImageCreateTrueColor doesn't work at all - I get just empty squares.
here is the code: --------------------------------------------------------------------- if (!$bigimage = @ImageCreateFromJPEG($image)) { $img = ImageCreate(100, 100); $red = ImageColorAllocate($img, 255, 0, 0); $yellow = ImageColorAllocate($img, 255, 255, 0); ImageString($img, 5, 20, 20, "Image", $yellow); ImageString($img, 5, 20, 40, "not", $yellow); ImageString($img, 5, 20, 60, "found!", $yellow); ImagePNG($img); ImageDestroy($img); exit(); } $tnimage = ImageCreate($tnsize, $tnsize); $darkblue = ImageColorAllocate($tnimage, 0, 0, 127); ImageColorTransparent($tnimage,$darkblue); $sz = GetImageSize($image); $x = $sz[0]; $y = $sz[1]; if ($x>$y) { $dx = 0; $w = $tnsize; $h = ($y / $x) * $tnsize; $dy = ($tnsize - $h) / 2; }else{ $dy = 0; $h = $tnsize; $w = ($x / $y) * $tnsize; $dx = ($tnsize - $w) / 2; } ImageCopyResized($tnimage, $bigimage, $dx, $dy, 0, 0, $w, $h, $x, $y); ImagePNG($tnimage); ImageDestroy($tnimage); ImageDestroy($bigimage); ---------------------------------------------------------------------------- ------ Does anyone know the solution? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php