【发布时间】:2012-09-19 17:06:39
【问题描述】:
这是 jpg:http://i.stack.imgur.com/PIFN0.jpg
假设我希望从/img.php?file_name=PIFN0.jpg 渲染此内容
这就是我尝试完成这项工作的方式:
/sample.php
<p>Here's my image:</p>
<img src="/img.php?file_name=PIFN0.jpg">
/img.php
<?php
$url = 'http://i.stack.imgur.com/' . $_GET['file_name'];
header('Content-type: image/jpeg');
imagejpeg($url);
?>
我希望/sample.php 显示图像。但这不起作用。我得到的只是一个破碎的图像。我做错了什么?
【问题讨论】:
标签: php image header http-headers