-1
watermark.php?image=images/reviews/1.jpg&watermark=watermark.png
$str = 'Some String';
$encoded = urlencode(base64_encode($str));
這對url字符串有效,但圖像不存在。base64編碼的網址
有幫助嗎?
watermark.php?image=images/reviews/1.jpg&watermark=watermark.png
$str = 'Some String';
$encoded = urlencode(base64_encode($str));
這對url字符串有效,但圖像不存在。base64編碼的網址
有幫助嗎?
您正在嘗試base64編碼圖像名稱。相反,你應該編碼圖像的二進制數據。
如果你想顯示一個base64圖像,你需要在文件的內容與src="data:image/(gif|jpg|png);base64,(base64 data)"
像這樣讀,然後在圖像標籤輸出:
//valid path to the image file
$file = '/images/watermark.png';
//Open the file for reading
$filehandle = fopen($file,'rb');
//Read the file contents
$imagedata = fread($filehandle, filesize($file));
//Close the file
fclose($filehandle);
//output base64 imagedata in an <img> tag like so:
echo '<img src="data:image/png;base64,'.base64_encode($imagedata).'"/>';
你Base64是'd2F0ZXJtYXJrLnBocD9pbWFnZT1pbWFnZXMvcmV2aWV3cy8xLmpwZyZ3YXRlcm1hcms9d2F0ZXJtYXJrLnBuZw =='什麼你期待這種情況發生嗎? –