强制下载图片 [英] Force download image
本文介绍了强制下载图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想强制图像的下载。我发现这个code:
I want to force the download of an image. I have found this code:
<FilesMatch "\.(?i:jpg|gif|png)$">
Header set Content-Disposition attachment
</FilesMatch>
但我有一个特殊的要求。我的图片,类似于巴纽
<a target="_blank" id="save_to_pc" href="/image.php?width=720&height=480&file=files/galleries/1549/01a750273f66cd8637bcd2811a34a3e5.jpg&nocrop=1"></a>
有人可以帮我筛选这一形象,让用户下载呢?
can someone help me to filter this image and let the user download it?
推荐答案
您可以通过在image.php的头信息提供内容处置
做到这一点。
You can do this by providing Content-Disposition
in the header information of your image.php.
header('Content-Disposition: attachment; filename="<your image filename>"');
这篇关于强制下载图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文