我想在此HTML表格中显示我存储在数据库中的图像。我将文件存储为'BLOB',我希望图像显示在'Photo'列下。我用什么代码来回显图像?
<table wactidth='100%' border='1' cellspacing='0' align="center">
<thead align='left'>
<th>Photo</th>
<th>Act Name</th>
<th>Genre</th>
<th>First Name</th>
<th>Last Name</th>
<th>Number of People</th>
<th>Actions</th>
</thead>
<tbody>
<?php foreach($acts as $act):?>
<tr>
<td><!-- I WANT TO DISPLAY THE IMAGES UNDER THIS COLUMN--></td>
<td><?php echo $act['ActName'];?></td>
<td><?php echo $act['Genre'];?></td>
<td><?php echo $act['ContactFirstName'];?></td>
<td><?php echo $act['ContactLastName'];?></td>
<td><?php echo $act['NumberOfPeople'];?></td>
<td><a href="?editact&actid=<?php echo $act['actid'];?>">Edit</a>|<a href="?delete&actid=<?php echo $act['actid'];?>">Delete</a>|<a href="upload&actid=<?php echo $act['actid'];?>">Upload Image</td>
</tr>
<?php endforeach?>
</tbody>
</table>
答案 0 :(得分:0)
我建议只存储图像的路径,例如“/path/to/your/image.jpg”。然后你可以像字符串一样回显路径
<td><img src="<?php echo $act['imagepath'];?>" alt="" /></td>