我试图使用PHP显示从表中的数据库检索到的图像,到目前为止这是成功的.但是,我的一些文字描述太长,并且比单个缩略图更长.
如您所见,"会计"字太长了.我想设置要在图像边框内设置的文本,所有图像的宽度都是350像素.如果它有帮助,这些是我的表的PHP代码.
echo "<table width = '100%' height ='100%'><tr>";
$rows_fetched = - 1;
while ($stmt->fetch()) {
$rows_fetched++;
if ($rows_fetched <= 2) {
echo "<td width = '350px'height = '100%'>";
echo "<a href='video-page.php'> <img src='$thumbnail' alt='' width='350px' height='200px'>";
echo "<h4>$title</h4>";
// echo "<h4> hi </h4>";
echo "</td>";
} else {
echo "</tr>";
echo "<tr>";
echo "<td width = '350px' height ='100%' >";
echo "<a class href='video-page.php'> <img src='$thumbnail' alt='' width='350px' height='200px'>";
echo "<h4 class ='img-with-text'>$title</h4>";
// echo "<h4> hi …Run Code Online (Sandbox Code Playgroud)