开发者

Not able to save the image created using php

开发者 https://www.devze.com 2023-02-17 13:45 出处:网络
I am adding some text to an image using PHP and then outputting it using: header(\'Content-type: image/jpeg\');

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')

0

精彩评论

暂无评论...
验证码 换一张
取 消