[英]How can i get an image from mysql database through php
我可以將圖像插入數據庫,但是找不到方法。圖像是通過網站插入的。 我的PHP代碼:
require_once('something.php');
$codservico=$_GET['id'];
$consulta="select * from xxxxx where xxxxx=".$something;
$resultado=mysql_query($consulta);
$nregistos=mysql_num_rows($resultado);
if($nregistos>0)
{
for ($i=0; $i<$nregistos; $i++){
$registo=mysql_fetch_array($resultado);
echo '<tr class="show">';
echo '<td class="show"><img src="data:image;base64,'.$registo['image'].'"></td>';
echo '</tr>';
}
}
else
{
echo "<td colspan='8' align='middle'>Nenhum registo encontrado</td>";
}
我得到這樣的東西: http : //costumerbook.netai.net/Capturar.PNG
您需要指定Content-Type
(圖像格式) data:image/png;base64
: data:image/png;base64
:
echo '<td class="show"><img src="data:image/png;base64,'.$registo['image'].'"></td>';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.