HTML顯示Base64圖像
在資料庫內有圖片資料為base64或是資料型態是image的資料
Base64編碼是一種圖片處理格式
通過特定的算法將圖片編碼成一長串字符串在頁面上顯示的時候
可以用該字符串來代替圖片的url屬性。
可以透過html進行轉換
以下為 利用php-base64_encode + html 的程式碼
<img src="data:image/jpeg;base64,<?=base64_encode($a['PIC'])?>" height="300" width="400" />
參考:
https://www.php.net/manual/en/function.base64-encode.php
https://stackoverflow.com/questions/8499633/how-to-display-base64-images-in-html