1
有没有办法显示外部图像与PHP缓存?带缓存的PHP(外部)安全映像?
我想显示图像,如: www.domain.com/safe_image.php?url=external.site.jpg
基本上像什么Facebook并。
达到这个目的的最佳方法是什么?
谢谢。
编辑
现在这是我的代码:
$image_url = $_GET['url'];
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $image_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$image = curl_exec($ch);
curl_close($ch);
// output to browser
header("Content-type: image/jpeg");
print $image;
好,缓存它们本地。你的问题到底是什么?如何获取图像?如何实现缓存? – 2010-10-23 13:05:59
我的问题是如何缓存它?我用我的实际代码编辑了这篇文章。 – PGZ 2010-10-23 13:11:58