【发布时间】:2012-01-11 05:35:41
【问题描述】:
我想在单击图像时打开保存图像对话框。我设法打开了相同的文件,但是保存时,它不会保存打开的保存图像,因为图像的内容没有以某种方式保存。
PHP 代码:
$imageName = $_GET['i'];
$imageName = $imageName . '-HR.jpg';
header ("Content-Type: application/download");
header ("Content-Disposition: attachment; filename=$imageName");
header("Content-Length: " . filesize("$imageName"));
$fp = fopen("$imageName", "r");
fpassthru($fp);
传递的 URL 类似于: mydomain/download_image.php?c=atherothrombosis&i=embolus-carotid-artery-illustration
请提出解决方案。谢谢。
【问题讨论】:
-
有什么保存吗?即使它不是有效的图像?如果是这样,那是什么!
标签: php image http-headers