如何在 php 中显示 blob 类型的图像?
How can I display image of blob type in php?
我正在尝试显示图像,但该图像类型是 blob
。
问题:
如何显示 blob
数据类型的图像?
我试过:
function getBlob() {
$data = $this->user_model->getBlob();
echo "<img src="base64_encode( $data['IMAGE'] )">";
}
但是不起作用。
您忘记了 data:URI
scheme (data:image/jpeg;base64,
) :
Wikipedia:
The data URI scheme is a URI scheme (Uniform Resource Identifier scheme) that provides a way to include data in-line in web pages as if they were external resources [...]
按如下操作:
echo '<img src="data:image/jpeg;base64,'.base64_encode( $data['IMAGE'] ).'"/>'
我正在尝试显示图像,但该图像类型是 blob
。
问题:
如何显示 blob
数据类型的图像?
我试过:
function getBlob() {
$data = $this->user_model->getBlob();
echo "<img src="base64_encode( $data['IMAGE'] )">";
}
但是不起作用。
您忘记了 data:URI
scheme (data:image/jpeg;base64,
) :
Wikipedia:
The data URI scheme is a URI scheme (Uniform Resource Identifier scheme) that provides a way to include data in-line in web pages as if they were external resources [...]
按如下操作:
echo '<img src="data:image/jpeg;base64,'.base64_encode( $data['IMAGE'] ).'"/>'