2013-02-01 109 views

回答

2

嗯,這裏是你想要的圖片的HTML:

<img src="image_render.php?image_id=4" /> <!-- or any unique identifier for that image --> 

image_render.php你將要做到以下幾點:

// get the image information base on the unique identifier passed in the URL 
header("Content-Type: image/png"); // tell the browser that this is an image 
echo $imageBlog; // this is what you took from the database 

確保你不添加額外的輸出這個文件,或者事情會變壞。

就是這樣。

注意

在大多數情況下,它是更好/更快簡單地將圖像位置存儲服務器,而不是在整個圖像上,所以你可能需要作出這個決定之前多一點來記錄自己。

這是關於advantages and disadvantages of storing images in the databaseanother one here的討論。

祝你好運!

0

我希望echo html_entity_decode($ blobfield)可以幫助您在使用任何編輯器上傳圖片時編寫圖片。

0

根據另一個answersimilar topic這裏SO,

echo "<dt><strong>Technician Image:</strong></dt><dd>" . 
'<img src="data:image/jpeg;base64,'. 
    base64_encode($row2['image']). 
    '" width="290" height="290">' . "</dd>"; 

*不要嘗試在發佈前進行搜索。

相關問題