我已经制作了一个包含 blob 图像和描述的数据库。描述连接到具有相同 ID 的 blob 数据。在此代码中,描述显示在其图像旁边。
显示图像页面
$query = "SELECT * FROM `photo`.`photo`";
$query_run = mysql_query($query);
while ($data = mysql_fetch_array($query_run)) {
echo '<'.'img src="id.php?id='.$data['id'].'">';
$short_description = substr($data['description'], 0, 10);
$long_description = $data['description'];
echo $long_description;
}
echo "<br><a href='Photosite.php'>Upload a Photo</a>";
将 blob 转换为 jpeg 以显示页面
$id = abs($_GET['id']);
$query = mysql_query("SELECT * FROM `photo`.`photo` WHERE id='$id'");
$data = mysql_fetch_array($query) or die (mysql_error());
$image = $data['image'];
$description = $data['description'];
$jpgimage = imagecreatefromstring($image);
$image_width = imagesx($jpgimage);
$image_height = imagesy($jpgimage);
$new_size = ($image_width + $image_height)/($image_width*($image_height/45));
$new_width = $image_width * $new_size;
$new_height = $image_height * $new_size;
$new_image = imagecreatetruecolor($new_width, $new_height);
imagecopyresized($new_image, $jpgimage, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
$imagearray = imagejpeg($new_image, null);
header('Content-type: image/jpeg');
echo $imagearray;
我的问题是如何将描述放在显示的图像下方?并且在描述旁边的图像旁边的描述旁边没有图像等等......?
大帮助谢谢!是的,我知道我的一些功能已经过时了,不需要提醒我谢谢!