#23398 [Opn->Fbk]: Thumbnails generation broken

From: Date: Tue, 29 Apr 2003 06:18:55 +0000
Subject: #23398 [Opn->Fbk]: Thumbnails generation broken
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38682@lists.php.net to get a copy of this message
ID: 23398 Updated by: derick@php.net Reported By: len at abcda dot com -Status: Open +Status: Feedback Bug Type: GD related Operating System: RedHat Linux 7.2 PHP Version: 4.3.2RC2 New Comment: Can you please try to com eup with a short script that doesn't depend on anything else but the script (and of course an image) so that we can copy and paste it from this bugreport? Please provide an URL to the image as you obviously can not paste it onto this bugreport. Derick Previous Comments: ------------------------------------------------------------------------ [2003-04-29 01:08:44] len at abcda dot com I am generating a thumbnail from a submitted image and i get a broken image, the colors there are inadequate. Here's the code i use: function ImageName () { if($_FILES['userfile']['type']!='image/gif' && $_FILES['userfile']['type']!='image/jpeg' && $_FILES['userfile']['type']!= 'image/pjpeg' || !isset($_SESSION['SESSION_UNAME'])){ return ''; } else { $time = time(); switch($_FILES['userfile']['type']) { case 'image/gif': $newname = './upload/' . $_FILES['userfile']['name'] . $time . ".gif"; if(!copy($_FILES['userfile']['tmp_name'],$newname)) { echo "Can't copy"; } $newname = $_FILES['userfile']['name'] . $time . ".gif"; break; case 'image/jpeg': case 'image/pjpeg': $newname = './upload/' . $_FILES['userfile']['name'] . $time . ".jpg"; if(!copy($_FILES['userfile']['tmp_name'],$newname)) { echo "Can't copy"; } $im = @ImageCreateFromJPEG($newname); $im_X = ImageSX($im); $im_Y = ImageSY($im); $ThumbSize = getthumbSize($im_X,$im_Y); $im_thumb = ImageCreate($ThumbSize['x'],$ThumbSize['y']); ImageCopyResized($im_thumb,$im,0,0,0,0,$ThumbSize['x'],$ThumbSize['y'],$im_X,$im_Y); $thumb_name = './upload/thumb-' . $_FILES['userfile']['name'] . $time . ".jpg"; ImageJPEG($im_thumb,$thumb_name); $newname = $_FILES['userfile']['name'] . $time . ".jpg"; break; } return $newname; } } this same thing happened in PHP 4.3.1, then it was fixed in PHP 4.3.2RC1, now it's present in PHP 4.3.2RC2 again... I think it has to do with the new version of built-in GD library 2.0.12 against 2.0.11 in PHP 4.3.2RC1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23398&edit=1

« previous php.bugs (#38682) next »