查了下资料,提供两种方法asp源码和PHP源码,
asp源码
如果你的服务器支持asp,你下载这些源码保存到自己的服务器上然后调用,相关代码不贴出了,请参考襄樊鑫网网络的 破解图片防盗链有绝招,这里讲的很详细,而且确实可以用,中文版。
PHP源码
PHP显示防盗链图片的方法也有很多,这里提下利用 PHP CURL扩展如何来实现,CURL用法参考PHP CURL hack to display random image use curl(英文版)
下面是我自己写的一段代码,用法:
http://your-domain-name/showpic.php?url=image_url
注:我写的只显示jpg图片,根据需求修要修改
<?php
$url = $_GET["url"];
//$url = str_replace("http:/","http://",$url);
$dir = pathinfo($url);
$host = $dir['dirname'];
$refer = $host.'/';
$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_REFERER, $refer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//激活可修改页面,Activation can modify the page
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
header("Content-type: image/jpeg");//代码支持jpeg,需要自己修改支持其他图片格式,
Code to support jpeg, need to modify to support other image formats
print( $data );
?>
遇到PHP 提示错误Cannot modify header information headers already sent ,请参阅
PHP不能修改标题信息标题提示已经发出的解决办法
Translate by google
The next check information provided by the two methods and PHP source code asp source code,
asp source code
If your server support asp, you download the source code is saved to its own server and then call the relevant code is not posted, please refer to the Xiangfan-Xin Network Display prevent hotlinking images use asp , here to talk about in great detail, and indeed can be used, the Chinese version.
PHPsource code<
PHP navigating to picture shows the method of prevention there are many here to mention using PHP CURL extension of how to achieve, CURL reference usage PHP CURL hack to display random image use php curl(English).
The following is a section of writing my own code, use like the below code:
http://your-domain-name/showpic.php?url=image_url
Note: I wrote the only shows jpg images to be amended in accordance with the demand for repair.
<?php
$url = $_GET["url"];
//$url = str_replace("http:/","http://",$url);
$dir = pathinfo($url);
$host = $dir['dirname'];
$refer = $host.'/';
$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_REFERER, $refer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//Activation can modify the page
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
header("Content-type: image/jpeg");//Code to support jpeg, need to modify to support other image formats
print( $data );
?>
PHP error encountered prompted Cannot modify header information headers already sent, please refer to,
Cannot modify header information headers already sent

Hi,请问Google的 GAE上有这种方便的代码么?
这个不是很清楚.