1 Reply Latest reply on Sep 12, 2008 8:44 AM by Newsgroup_User

    uploading and creating thumbnails with PHP works in FF but not IE

    Level 7
      I've got a form with which the user can upload jpgs. A thumbnail file
      is automatically created and saved at the same time. Someone else wrote
      the PHP code for me to do this.

      If I upload pictures with Firefox, everything is working fine. However
      if I upload the same picture with IE7, the thumbnail that is created is
      just a black rectangle. The full size version is fine.

      This is very puzzling and I've no idea why this would happen. I'm
      guessing it has something to do with the following section of code, but
      I might be way off here.

      if ($success)
      {
      chmod(UPLOAD_DIR.$username.'/'.$username.$i.'.'.$path_parts['extension'],
      0644);

      if (!is_dir(UPLOAD_DIR.$username.'/thumbs')) {
      mkdir(UPLOAD_DIR.$username.'/thumbs');
      }
      $imagepath = $username.$i.'.'.$path_parts['extension'];
      $save = UPLOAD_DIR.$username.'/thumbs/'. $imagepath; //This is the new
      file you saving
      $file = UPLOAD_DIR.$username.'/'. $imagepath; //This is the original file
      list($width, $height) = getimagesize($file) ;
      $modwidth = 150;
      $diff = $width / $modwidth;
      $modheight = $height / $diff;
      $tn = imagecreatetruecolor($modwidth, $modheight) ;
      if($imgtype=='image/jpeg')
      {
      $image = imagecreatefromjpeg($file) ;
      }
      else if($imgtype=='image/gif')
      {
      $image = imagecreatefromgif($file) ;
      }
      imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth,
      $modheight, $width, $height) ;

      imagejpeg($tn, $save, 100) ;


      Can anyone help?
      Thanks
      Vix
      (Using PHP5 and GD2)