I really don’t know what’s wrong here and why it isn’t recreating the new image to a new directory. Please help! The image isn’t being created for some reason. I’m coding everything in Microsoft’s WebMatrix.
public static function imgResize($imgdir){
list($width, $height) = getimagesize($imgdir);
$ratio = $width/$height;
$new_height = 90;
$new_width = round($new_height * $ratio);
$new_image = imagecreatetruecolor($new_width, $new_height);
$old_image = imagecreatefromjpeg($imgdir);
imagecopyresampled($new_image, $old_image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($new_image, "gal/newimages/", 100);
}
imagejpeg needs a filename, not a directory. Try:
also, does the folder exist? If not, you need to create it first.