CODE
// Make new image
$new = imagecreatetruecolor($new_width, $new_height);
// Create source image
if ($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 image
imagecopyresampled($new, $source, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output new image
if ($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");
}
$new = imagecreatetruecolor($new_width, $new_height);
// Create source image
if ($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 image
imagecopyresampled($new, $source, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output new image
if ($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");
}
$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 form
Once 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