envexlabs Posted April 2, 2009 Share Posted April 2, 2009 Hello, I have a image upload and crop script, but i've hit a road block and can't seem to find a solution. This script works in firefox, but in ie7 it will generate the correct fullsize, but it wont create the thumbnail. It is running through the script fine and not returning any error, which means the user is redirected to products. Here is the chunk of code, anyone see anything i'm not? require $root.'/inc/php/classes/class.cropcanvas.php'; //lets crop the iamge $cc =& new CropCanvas(); $cc->loadImage($root.'/user_files/' . $path . '/'.$_GET['pic']); $cc->cropToDimensions($_GET['x1'], $_GET['y1'], $_GET['x2'], $_GET['y2']); $cc->saveImage($root.'/user_files/' . $path . '/'.$_GET['pic']); //lets resize the image $pic = $root.'/user_files/' . $path . '/'.$_GET['pic']; $thumbpic = $root.'/user_files/' . $path . '/thumb/'.$_GET['pic']; $img_info = getimagesize($pic); switch($img_info['mime']){ case'image/jpeg': $src = imagecreatefromjpeg($pic); $tsrc = imagecreatefromjpeg($pic); break; case'image/jpg': $src = imagecreatefromjpeg($pic); $tsrc = imagecreatefromjpeg($pic); break; case'image/gif': $src = imagecreatefromgif($pic); $tsrc = imagecreatefromgif($pic); break; case'image/png': $src = imagecreatefrompng($pic); $tsrc = imagecreatefrompng($pic); break; } $tmp = imagecreatetruecolor($width,$height); // this line actually does the image resizing, copying from the original // image into the $tmp image imagecopyresampled($tmp,$src,0,0,0,0,$width,$height,$img_info[0],$img_info[1]); if(imagejpeg($tmp,$pic,100)){ //fullsize created //create the thumb $thumb = imagecreatetruecolor($thumbw,$thumbh); imagecopyresampled($thumb,$tsrc,0,0,0,0,$thumbw,$thumbh,$img_info[0],$img_info[1]); if(imagejpeg($thumb,$thumbpic,100)){ //thumbnail created //send them hom if($_GET['from'] == 'change'){ header('Location: '.$from_change); }else{ header('Location: '.$redirect); } }else{ $class = 'error'; $result['title'] = 'There was a problem changing your image'; $result['text'] = 'We could not create the full-size version. Please try again!'; } }else{ $class = 'error'; $result['title'] = 'There was a problem changing your image'; $result['text'] = 'We could not create the full-size version. Please try again!'; } Thanks, envex Link to comment https://forums.phpfreaks.com/topic/152270-solved-ie7-seems-to-skip-a-chunk-of-code/ Share on other sites More sharing options...
Mark Baker Posted April 2, 2009 Share Posted April 2, 2009 Ah! The infamous IE MIME type of 'image/pjpeg' strikes again Link to comment https://forums.phpfreaks.com/topic/152270-solved-ie7-seems-to-skip-a-chunk-of-code/#findComment-799626 Share on other sites More sharing options...
envexlabs Posted April 2, 2009 Author Share Posted April 2, 2009 I knew it When i print_r()'d before it was just giving me image/jpeg so i passed it by. I will give this a shot. Thanks! UPDATE That didn't seem to work, and on further investigation it's not cropping the fullsize image either. It's just displaying the original uploaded and uncropped image. Link to comment https://forums.phpfreaks.com/topic/152270-solved-ie7-seems-to-skip-a-chunk-of-code/#findComment-799629 Share on other sites More sharing options...
PFMaBiSmAd Posted April 2, 2009 Share Posted April 2, 2009 Add the following two lines immediately after your first opening <?php tag - ini_set ("display_errors", "1"); error_reporting(E_ALL); Link to comment https://forums.phpfreaks.com/topic/152270-solved-ie7-seems-to-skip-a-chunk-of-code/#findComment-799635 Share on other sites More sharing options...
envexlabs Posted April 2, 2009 Author Share Posted April 2, 2009 Hey, It was a javascript problem, not a php one Thanks again! Link to comment https://forums.phpfreaks.com/topic/152270-solved-ie7-seems-to-skip-a-chunk-of-code/#findComment-799701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.