surfsup Posted August 13, 2007 Share Posted August 13, 2007 I have the following code. $filename = $_FILES['imagefile']['name']; $temporary_name = $_FILES['imagefile']['tmp_name']; $mimetype = $_FILES['imagefile']['type']; $filesize = $_FILES['imagefile']['size']; $agencyIDimg = $_SESSION['agencyID']; switch($mimetype) { case "image/jpg": case "image/jpeg": case "image/pjpeg": $i = imagecreatefromjpeg($temporary_name); break; case "image/gif": $i = imagecreatefromgif($temporary_name); break; case "image/png": $i = imagecreatefrompng($temporary_name); break; } unlink($temporary_name); imagejpeg($i,"images/uploadedfile.jpg",80); $dest_x = 200; $dest_y = 200; if (imagesx($i) > $dest_x or imagesy($i) > $dest_y) { //Is the width of the original bigger than the height? if (imagesx($i) >= imagesy($i)) { $thumb_x = $dest_x; $thumb_y = imagesy($i)*($dest_x/imagesx($i)); } else { $thumb_x = imagesx($i)*($dest_y/imagesy($i)); $thumb_y = $dest_y; } } else { $thumb_x = imagesx($i); $thumb_y = imagesy($i); } $thumb = imagecreatetruecolor($thumb_x,$thumb_y); imagecopyresampled($thumb, $i ,0, 0, 0, 0, $thumb_x, $thumb_y, imagesx($i), imagesy($i)); imagejpeg($thumb, "agencyimages/$filename", 80); All works fine in FF but IE keeps giving me the following errors. I searched through the forum but can't seem to find an answer. Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\wamp\www\wottodo\imageuploadAgency2.php on line 94 Warning: imagesx(): supplied argument is not a valid Image resource in C:\wamp\www\wottodo\imageuploadAgency2.php on line 101 Warning: imagesy(): supplied argument is not a valid Image resource in C:\wamp\www\wottodo\imageuploadAgency2.php on line 101 Warning: imagesx(): supplied argument is not a valid Image resource in C:\wamp\www\wottodo\imageuploadAgency2.php on line 112 Warning: imagesy(): supplied argument is not a valid Image resource in C:\wamp\www\wottodo\imageuploadAgency2.php on line 113 Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in C:\wamp\www\wottodo\imageuploadAgency2.php on line 117 Warning: imagesx(): supplied argument is not a valid Image resource in C:\wamp\www\wottodo\imageuploadAgency2.php on line 120 Warning: imagesy(): supplied argument is not a valid Image resource in C:\wamp\www\wottodo\imageuploadAgency2.php on line 120 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in C:\wamp\www\wottodo\imageuploadAgency2.php on line 120 Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\wamp\www\wottodo\imageuploadAgency2.php on line 123 Any help would be great Quote Link to comment https://forums.phpfreaks.com/topic/64641-solved-gd-and-ie-problems/ Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 change switch($mimetype) { case "image/jpg": case "image/jpeg": case "image/pjpeg": $i = imagecreatefromjpeg($temporary_name); break; case "image/gif": $i = imagecreatefromgif($temporary_name); break; case "image/png": $i = imagecreatefrompng($temporary_name); break; } to switch($mimetype) { case "image/jpg": $i = imagecreatefromjpeg($temporary_name); case "image/jpeg": $i = imagecreatefromjpeg($temporary_name); case "image/pjpeg": $i = imagecreatefromjpeg($temporary_name); break; case "image/gif": $i = imagecreatefromgif($temporary_name); break; case "image/png": $i = imagecreatefrompng($temporary_name); break; } Quote Link to comment https://forums.phpfreaks.com/topic/64641-solved-gd-and-ie-problems/#findComment-322268 Share on other sites More sharing options...
surfsup Posted August 13, 2007 Author Share Posted August 13, 2007 Still giving me the same error Quote Link to comment https://forums.phpfreaks.com/topic/64641-solved-gd-and-ie-problems/#findComment-322272 Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 really need more info, try this and post the results //added print_r($_FILES); die("END"); switch($mimetype) { case "image/jpg": $i = imagecreatefromjpeg($temporary_name); case "image/jpeg": $i = imagecreatefromjpeg($temporary_name); case "image/pjpeg": $i = imagecreatefromjpeg($temporary_name); break; case "image/gif": $i = imagecreatefromgif($temporary_name); break; case "image/png": $i = imagecreatefrompng($temporary_name); break; default: die("FAILED: Bad mimetype"); } Quote Link to comment https://forums.phpfreaks.com/topic/64641-solved-gd-and-ie-problems/#findComment-322274 Share on other sites More sharing options...
surfsup Posted August 13, 2007 Author Share Posted August 13, 2007 Dohhh !!! Your first solution worked a treat. I hadn't been checking the file I actually made the change to Thanks Quote Link to comment https://forums.phpfreaks.com/topic/64641-solved-gd-and-ie-problems/#findComment-322277 Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 LOL Cool, Quote Link to comment https://forums.phpfreaks.com/topic/64641-solved-gd-and-ie-problems/#findComment-322278 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.