#23398 [Fbk->Opn]: Thumbnails generation broken
| From: | len at abcda dot com | Date: | Tue, 29 Apr 2003 06:47:39 +0000 |
| Subject: | #23398 [Fbk->Opn]: Thumbnails generation broken | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-38686@lists.php.net to get a copy of this message | ||
ID: 23398
User updated by: len at abcda dot com
Reported By: len at abcda dot com
-Status: Feedback
+Status: Open
Bug Type: GD related
Operating System: RedHat Linux 7.2
PHP Version: 4.3.2RC2
New Comment:
Here's the image i used to get when i tried using built-in GD library
in PHP 4.3.1:
http://www.abcda.com/upload/thumb-lyonchik22.jpg1045676715.jpg
Same generated thumbnail, but with PHP 4.3.2RC1 built-in 2.0.11 GD:
http://www.abcda.com/upload/thumb-lyonchik22.jpg1045677288.jpg
And i just downloaded the new PHP 4.3.2RC2 and compiled it with the
same options i used when i compiled PHP 4.3.2RC1, and here's what i get
when it generates a thumbnail:
http://www.abcda.com/upload/thumb-lyonchik22.jpg1051596060.jpg
the function i posted here does everything in the script.
I just upload an image and call this function and it uploads the
selected image and generates a thumbnail from it.
Previous Comments:
------------------------------------------------------------------------
[2003-04-29 01:18:54] derick@php.net
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
------------------------------------------------------------------------
[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