Jervous Posted March 13, 2006 Share Posted March 13, 2006 Hello everyone. I am writing a script to resize images, and am stuck with this problem. I know for a fact that the problem is NOT that any of the variables are unset, because I have checked and they are all set. If anyone could help I would be very appreciative :)[code]// Make new image$new = imagecreatetruecolor($new_width, $new_height); // Create source imageif ($file_type_ns == "jpg" OR $file_type_ns == "jpeg"){ $source = imagecreatefromjpeg("uploads/$file_name");} if ($file_type_ns == "gif"){ $source = imagecreatefromgif("uploads/$file_name");} if ($file_type_ns == "png"){ $source = imagecreatefrompng("uploads/$file_name");}// Build new imageimagecopyresampled($new, $source, 0, 0, 0, 0, $new_width, $new_height, $width, $height);// Output new imageif ($info_type == "jpeg" OR $info_type == "jpg"){ imagejpeg($new, "images/$file_name_ns.jpeg", $quality);}if ($info_type == "gif"){ imagegif($new, "images/$file_name_ns.gif");}if ($info_type == "png"){ imagepng($new, "images/$file_name_ns.png");}[/code]$file_type_ns: the file type from $_FILES with the suffix extension$info_type: the new file type that a user has already chosen from a formOnce again, all these variables have already been set. I get no errors or anything, but when I go to look at the new image, it is the right size and type, but it is completely black. Thanks to anyone who can help :) Quote Link to comment Share on other sites More sharing options...
Masna Posted March 13, 2006 Share Posted March 13, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]the new file type that a user has already chosen from a form[/quote]This may seem a bit of a stupid question, but, "new file type that a user has already chosen". Why are you allowing users choose the file type? Use the file type they uploaded. Can the file type be changed, just like that? (Excuse me if I'm wrong, I barley ever work with the image functions of PHP) Quote Link to comment Share on other sites More sharing options...
Jervous Posted March 13, 2006 Author Share Posted March 13, 2006 It's because I am creating a script for users to upload and change their images, and yes, it is possible. Quote Link to comment Share on other sites More sharing options...
Jervous Posted March 13, 2006 Author Share Posted March 13, 2006 Anyone at all? Please? 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.