我有一个包含电影名称、描述和封面图片的数据库。封面图片字段类型为 blob,问题是我无法从数据库中检索它。我想在他们旁边的封面图片上显示电影名称...如何做到这一点..这是我的代码..
<?php
include ("php/connection.php");
$ID = $_GET['id'];
$listmovies = "SELECT * FROM movies where Genres LIKE '%$ID%'";
$result = mysql_query($listmovies);
while ( $row = mysql_fetch_assoc($result) ) {
?>
<table border="1" width="100%">
<tr>
<td rowspan="2" width="90" height="120">
<?php
// set the header for the image
header("Content-type: image/jpeg");
echo $row['Image'];
?> </td>
<td width="200" height="10">
<?php
echo $row['Title'];
?></td>
</tr>
<tr>
<td width="200" height="110"><a
href="php/moredetails.php?id=<?php echo $row['ID']; ?>">More Detail</a></td>
</tr>
<?php } ?> </table>
我只想在电影标题旁边显示图像?
是的,它不会显示,因为any output above header would always generate error
...您需要有一个不同的页面来输出您的图像或包含它base64
image
Remove
header("Content-type: image/jpeg");
echo $row['Image'];
并添加以下内容:
printf("<img src=\"data:image/jpeg;base64,%s\" />",base64_encode($row['Image']));
^--- Note this is only for jpeg images
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)