#23398 [NEW]: Thumbnails generation broken
| From: | len at abcda dot com | Date: | Tue, 29 Apr 2003 06:08:45 +0000 |
| Subject: | #23398 [NEW]: Thumbnails generation broken | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-38679@lists.php.net to get a copy of this message | ||
From: len at abcda dot com
Operating system: RedHat Linux 7.2
PHP version: 4.3.2RC2
PHP Bug Type: GD related
Bug description: Thumbnails generation broken
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 bug report at http://bugs.php.net/?id=23398&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23398&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23398&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23398&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23398&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23398&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23398&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23398&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23398&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23398&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23398&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23398&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23398&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23398&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23398&r=gnused