Not able to save the image created using php
I am adding some text to an image using PHP and then outputting it using:
header('Content-type: image/jpeg');
imagejpeg($rImg, NULL, 100);
The image 开发者_开发技巧is displayed correctly, but when I right click to save the image, it saves it as a PHP file and not an image. What am I doing wrong?
you have add a header for the file name
example:
header('Content-Disposition: attachment; filename="new_image.jpg"');
(can use 'inline' or 'attachment')
精彩评论