| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2003-04-29 01:18 UTC] derick@php.net
  [2003-04-29 01:47 UTC] len at abcda dot com
  [2003-04-29 02:44 UTC] pajoye@php.net
  [2003-04-29 02:50 UTC] len at abcda dot com
  [2003-04-29 03:02 UTC] pajoye@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 13:00:02 2025 UTC | 
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