我只是想知道PHP代碼是什麼回聲我已經存儲在我的數據庫的特定表中的圖像。如何在我的數據庫中回顯存儲爲blob的圖像?
0
A
回答
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 database和another one here的討論。
祝你好運!
0
我希望echo html_entity_decode($ blobfield)可以幫助您在使用任何編輯器上傳圖片時編寫圖片。
0
根據另一個answer在similar 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>";
*不要嘗試在發佈前進行搜索。
相關問題
- 1. 如何顯示存儲在MySql數據庫中的BLOB圖像?
- 2. 將數據庫中存儲的圖像顯示爲blob type.in PHP?
- 3. 存儲圖像爲BLOB數據庫
- 4. 如何將圖像作爲Blob存儲在數據庫中?
- 5. 我想顯示圖像在PHP數據庫中存儲的作爲blob類型
- 6. 顯示圖像存儲爲BLOB在數據庫
- 7. 在MySQL數據庫中打開存儲爲BLOB的圖像
- 8. 在MySql數據庫中顯示保存爲Blob的圖像
- 9. 顯示作爲圖庫存儲在數據庫中的圖像
- 10. 如何上傳jsp中的圖像和存儲數據庫中的圖像blob
- 11. onmouseover在數據庫中存儲在blob中的圖像
- 12. 使用Wicket在MYSQL數據庫中顯示存儲爲BLOB的圖像
- 13. 我如何將圖像保存爲Sqlite數據庫爲blob?
- 14. Yii2顯示圖像存儲在BLOB數據庫字段
- 15. 將圖像作爲blob存儲到Oracle數據庫的問題
- 16. JSP:我如何將圖像從HTML img標記存儲爲數據庫blob
- 17. 如何顯示存儲在數據庫中的圖像?
- 18. 如何顯示名稱存儲在數據庫中的圖像
- 19. 如何顯示存儲在mysql數據庫中的圖像
- 20. 如何顯示存儲在數據庫中的所有圖像
- 21. 如何顯示存儲在MySQL數據庫中的圖像?
- 22. 如何獲取以BLOB格式存儲在數據庫中的圖像的URL
- 23. 在數據存儲區中作爲Blob存儲在html頁面中的圖像
- 24. 存儲在MySQL數據庫中的BLOB
- 25. 如何在圖庫中存儲SQLite數據庫中的圖像
- 26. 如何顯示存儲在數據庫中的圖像作爲blob,在網頁中
- 27. 如何將圖像存儲在我的SQL數據庫中?
- 28. 如何在MySQL中存儲blob(圖像)?
- 29. 如何將圖像存儲在BLOB中?
- 30. 將存儲在數據庫中的BLOB轉換爲HTML網站上的圖像
您是否將圖像路徑保存在數據庫或圖像數據中? – laxonline
'http:// stackoverflow.com/questions/5525830/displays-an-image-stored-in-a-mysql-blob' – ashley