有什么方法讲远程动态图片地址加密或者转换其他编码也可以 PHP我用<?php
//header('Content-Type:image/gif');
readfile(base64_decode(trim($_GET['imgid'])));
?> 这种不行,我的主机不支持,多数都是错误的
请问还有其他的方法吗?
//header('Content-Type:image/gif');
readfile(base64_decode(trim($_GET['imgid'])));
?> 这种不行,我的主机不支持,多数都是错误的
请问还有其他的方法吗?
echo '原地址:'.$remoteUrl = 'http://img.baidu.com/img/post-jg.gif';echo "\n加密后的地址:".$newUrl = encrptURL($remoteUrl,10);
echo "\n解密后的地址:".$oldUrl = decrptURL($newUrl,10);
/**
* ciray简单字符串加密算法
*
* @param string $str
* @param int $key
* @return string
*/
function encrptURL($str,$key)
{
$newUrlArr = array();
for($i=0;$i<strlen($str);$i++)
{
$intCh = ord($str[$i]) ;
$intCh += $key;//加密密钥(可修改为其他整数)
$newUrlArr[] = chr($intCh);
}
return $newUrl = join("",$newUrlArr);
}function decrptURL($str,$key)
{
$newUrlArr = array();
for($i=0;$i<strlen($str);$i++)
{
$intCh = ord($str[$i]) ;
$intCh -= $key;//解密密钥(须与加密密钥一致)
$newUrlArr[] = chr($intCh);
}
return $newUrl = join("",$newUrlArr);
}
?>
其形式是
<img width=310 src="images.php?imgid=<?php echo $pic_url ?>" height=310>
$pic_url为远程动态的图片地址
<img width=310 src="images.php?imgid=<?php echo rawurlencode($pic_url); ?>" height=310>
$_GET['imgid']即可
楼上的兄弟只是将url进行编码,但没有达到加密的效果。
header("Content-tyoe:image/jepg");
?>
<?php
$src=$_GET[p];
$src=base64_decode($src);
readfile($src);
?>