Using this logic to resize and print an image:
$image_path="path/to/image.extension";
$image_path=imagecreatefromjpeg($image_path);
$width=imagesx($image_path);
$height=imagesy($image_path);
$new_image=imagecreatetruecolor($w, $h);
imagecopyresampled($new_image,$image_path,0,0,0,0,$w,$h,$width,$height);
header('Content-Type: image/jpeg');
imagejpeg($new_image,100);
imagedestroy($new_image);
But I am getting image missing icon as output. What is the mistake I do? I have tried printing the variables $width
and $height
and it prints the dimension of source image. So the path is correct.
What could be the error?