[英]How can i get an image from mysql database through php
I can insert my image in database but i dont find a way to get it.The image was inserted through the website. 我可以将图像插入数据库,但是找不到方法。图像是通过网站插入的。 My php code:
我的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>";
}
And i get something like this: http://costumerbook.netai.net/Capturar.PNG 我得到这样的东西: 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.