Ⅰ 求用php將遠程調用的圖片地址隱藏的方法
簡單一點的是直接用base64_encode編碼和base64_decode解碼。如下:
//圖片輸出頁 imageOutput.php
<html>
<head>
<title>OutPut Image</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
</head>
<body>
<div><img src="http://www.test.com/getImage_process.php?id=<?php echo base64_encode('http://img01.taobaocdn.com/bao/uploaded/i1/T1KNuWXdlgXXXBSUbb_095424.jpg_460x460.jpg')?>"/></div>
</body>
</html>
//圖片處理頁 getImage_process.php
<?php
$url = base64_decode ($_GET['id']);
echo file_get_contents($url);
//End_php
Ⅱ javascript php如何隱藏圖片真實地址用問號的形式表示.
這是因為怕被盜圖,或者被破譯。很簡單地,所有的圖片顯示都是從一個img.php 出去,後面上?後面跟參數,img.php頁面根據不同的參數,才找到伺服器上的圖片。
img.php代碼示例:
header("Content-type: image/png;charset=utf8"); //該頁面是顯示圖片的
$im = imagecreatefromjpeg("../img/mat/ad/linktech/{$v}/{$s}.jpg"); //根據不同參數找到對應的圖片
header("Cache-Control: max-age=1, s-maxage=1, no-cache, must-revalidate");
header("Content-type: image/png;charset=utf8");
imagepng($im); //顯示圖片文件
imagedestroy($im);
如果參數錯誤,或者訪問沒有session控制,就不顯示圖片。
Ⅲ 求用PHP將遠程調用的圖片地址隱藏的方法
寫一個 image.php 通過傳遞參數來決定顯示什麼圖片;image.php:<?php$url = isset($_GET['url']) ? trim($_GET['url']) : '';if (!empty($url)){ echo $url;}else{ echo 'error';} <img src="image.php?url= http://xxx.com/xxx.jpg">
Ⅳ php網站,html網頁怎樣隱藏圖片的真實地址或名稱。
可以了解下防盜鏈技術,限制只能是規定的頁面才可以訪問你的圖片...
Ⅳ php隱藏圖片真實地址代碼怎麼用
<?php
/**
* @molar 這個腳本將會隱藏圖片的真實地址
* @param name string 圖片名稱
* @example <img src=" http://www.xxx.com/getImg.php?name=demo.jpg" />
* 等同於 <img src=" http://www.xxx.com/images/demo.jpg" />
*/
//設置圖片真實地址所在的文件夾,您所帖的代碼當中少了一個分號.程序會報錯
$image_path="images/";
//從URL當中得到文件名.比方說本程序的名字為getImg.php,傳入參數name=demo.jpg
//即URL地址為getImg.php?name=demo.jpg,
$image_file=$image_path.$_GET['name'];
//以只讀模式打開文件
$sTmpVar = fread(fopen($image_file, 'r'), filesize($image_path));
//設置文件頭顯示為圖片.
header("Content-type: image/* ");
//輸出數據流
echo $sTmpVar;
?>
Ⅵ php隱藏圖片真實地址代碼
/*圖片轉換為base64格式編碼*/
$img='uploads/01.png';
$base64_img=base64EncodeImage($img);
echo'<imgsrc="'.$base64_img.'"/>';
functionbase64EncodeImage($image_file){
$base64_image='';
$image_info=getimagesize($image_file);
$image_data=fread(fopen($image_file,'r'),filesize($image_file));
$base64_image='data:'.$image_info['mime'].';base64,'.chunk_split(base64_encode($image_data));
return$base64_image;
}
你可以把圖片內容轉為base64的,這樣就不會圖片的地址了,但是頁面體積會變大,
<img src="base64之後的值 />