shanelarson55 Posted May 2, 2012 Share Posted May 2, 2012 I have a script that saves a full size and a cropped version that is re-sized to 200x200. The full size saves just fine the cropped and re-sized version is all messed up. Example: Here is the cropped and re-size code: $new_cropped_image_resource = imagecreatetruecolor(200, 200); switch($photo["ext"]){ case "gif": $cropped_image = imagecreatefromgif($processing_image_temp_name_cropped); break; case "jpg": $cropped_image = imagecreatefromjpeg($processing_image_temp_name_cropped); break; case "png": $cropped_image = imagecreatefrompng($processing_image_temp_name_cropped); break; } list($cropped_width, $cropped_height) = getimagesize($processing_image_temp_name_cropped); imagecopyresampled($new_cropped_image_resource,$cropped_image,0,0,0,0,200,200,$cropped_width,$cropped_height); switch($photo["ext"]){ case "gif": imagegif($new_cropped_image_resource, $processing_image_temp_name_cropped); break; case "jpg": imagejpeg($new_cropped_image_resource, $processing_image_temp_name_cropped, 100); break; case "png": imagepng($new_cropped_image_resource, $processing_image_temp_name_cropped); break; } Any ideas? I'm stuck :/ Thanks for any help -Shane Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 2, 2012 Share Posted May 2, 2012 Define "all messed up" Quote Link to comment Share on other sites More sharing options...
shanelarson55 Posted May 2, 2012 Author Share Posted May 2, 2012 The black and blue lines in the image shouldn't be there. Quote Link to comment Share on other sites More sharing options...
xyph Posted May 2, 2012 Share Posted May 2, 2012 We can't see the image. Quote Link to comment Share on other sites More sharing options...
shanelarson55 Posted May 2, 2012 Author Share Posted May 2, 2012 Huh its showing up for me on my post huh, can you view it here: http://s18.postimage.org/9duuzfdxz/issue.png Can you view it? Quote Link to comment Share on other sites More sharing options...
xyph Posted May 2, 2012 Share Posted May 2, 2012 Yes. Was this a transparent GIF? You should check out the user comments for imagegif(). There's tons of potential odd behaviour. http://www.php.net/manual/en/function.imagegif.php Quote Link to comment Share on other sites More sharing options...
shanelarson55 Posted May 2, 2012 Author Share Posted May 2, 2012 It was a normal gif outta paint. Quote Link to comment Share on other sites More sharing options...
shanelarson55 Posted May 2, 2012 Author Share Posted May 2, 2012 I figured out it is the imagecopyresampled function that messes it up. Quote Link to comment Share on other sites More sharing options...
shanelarson55 Posted May 3, 2012 Author Share Posted May 3, 2012 So I decided to test and see if another gif would work. It did!!! The first gif I made in paint, just a normal image. it failed when cropped and looked as shown in that photo. The other 3 tests were random images i made in paint again the same way just this time they were all different sizes and colors and worked just fine. Weird that one photo just refused to re-size w/o issue. Any ideas why? Quote Link to comment 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.