在php中,如何下载图像,同时使用页眉在浏览器中显示该图像?

在php中,如何下载图像,同时使用页眉在浏览器中显示该图像?,php,image,download,header,Php,Image,Download,Header,我使用php将水印应用到图像上,在上传图像后,固定水印将粘贴到图像上,最后我可以显示图像或下载图像,但我想同时执行这两项操作 这段代码向我显示了最后一段的图像 header('Content-Type: image/jpeg'); imagejpeg($new_canvas, NULL , 90); header('Content-Disposition: Attachment;filename=image.jpeg'); imagejpeg($new_canvas,

我使用php将水印应用到图像上,在上传图像后,固定水印将粘贴到图像上,最后我可以显示图像或下载图像,但我想同时执行这两项操作

这段代码向我显示了最后一段的图像

header('Content-Type: image/jpeg');
imagejpeg($new_canvas, NULL , 90);
header('Content-Disposition: Attachment;filename=image.jpeg');
            imagejpeg($new_canvas, NULL , 90);
这段代码在最后一次下载图像

header('Content-Type: image/jpeg');
imagejpeg($new_canvas, NULL , 90);
header('Content-Disposition: Attachment;filename=image.jpeg');
            imagejpeg($new_canvas, NULL , 90);
但我不能同时做这两件事

我试过了,但没有结果

header('Content-Type: image/jpeg');
 header('Content-Disposition: Attachment;filename=image.jpeg');
                imagejpeg($new_canvas, NULL , 90);

不能这样设置多个不同的标题。您可能需要2个文件。。使用带有链接的标准
标记显示图像,并链接到下载图像的第二个文件。然后您可以在每个文件上设置适当的标题。如何使用标记显示该图像,因为我没有将该图像保存在服务器端。您可以使用base64对图像进行编码。看见