我知道在桌子中存储图像是不受欢迎的,但你能告诉我为什么这不起作用吗?我试图在桌子的最后一栏显示一个小图像,没有任何乐趣。
header("content-type:image/jpeg");
// Retrieve the boat name from the URL.
$angler = $_GET['angler'];
$sql = "SELECT DateCaught, Angler, Species, Notes, PhotoName, Photo FROM SpeciesHuntAnglers WHERE Angler='$angler' ORDER BY DateCaught ASC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<br><br><table border=1 bordercolor=#EBF4F9 cellspacing=0 cellpadding=3 style=color:#3D6594><tr><th>Date Caught</th><th>Angler</th><th>Species</th><th>Notes</th><th>PhotoName</th><th>Photo</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . date('F Y', strtotime($row["DateCaught"])). "</td><td>" . $row["Angler"]. "</td><td>" . $row["Species"]. "</td><td>" . $row["Notes"]. "</td><td>" . $row["PhotoName"]. "</td><td><img src="data:image/jpeg; base64,'.base64_encode($row['Photo']).'"/></td></tr>";
}
echo "</table><br>";
}
答案 0 :(得分:0)
Rajnish - 谢谢。它应该是:
<img src='data:image/jpeg;base64,".base64_encode($row['Photo'])."'/>