I've got this strange situation going on. Imagejpeg is only working when I define a filename to which the image is going to be saved. The problem is that I don't want to save the image, I just want to show it.
This is my code:
header('Content-Type: image/jpeg');
$img = imagecreatefromjpeg("./_test/test.jpg");
imagejpeg($img, null, 100);
That doesn't work, but if I just change the last line to:
imagejpeg($img, "./_test/blah.jpg", 100);
The image is being saved as it should be.
Doesn anyone have experiance with this problem and knows a solution?
Is your image script file stored as UTF8 instead of ANSI? If so, then that might be your problem. See this answer to an earlier similar question:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.