下一页有更多信息的图片

问题描述 投票:0回答:2

图像存储在我的文件夹中而不是数据库中。当我点击其中一个图像时,它会引导我在下一页上看到更多信息。这意味着我可以看到更大尺寸的图像。

如何使用较少的php页面创建?以下是我的代码片段

<table>
<tr> 
<th class="timgB"><h4><img src="city/GVcementMixture.jpg" style="vertical-align: text-bottom;" title="Cement Mixture"/> Cement Mixture </a></h4></th>
</tr> 
</table>
php image html-table
2个回答
0
投票

您可以使用大的if / else或switch / case语句将其全部保存在一个表单/页面中,以评估所选图像并仅显示与所选图像有关的信息,例如全尺寸图像或子图像子集。但是@Razor说,最好在jQuery中呈现。

<form ...>
    <button type=submit name=imgID value=1>
    <button type=submit name=imgID value=2>
    ...

<?php
    if (isset($_POST['imgID'])):
        // Show info related to selected image
        ...

0
投票

你可以这样做。使用class="small使图像尺寸小和class="big-img"到大尺寸图像。你链接中的?img=img23.jpg决定哪个图像应该以大尺寸显示。或者如果您使用图像缩略图作为小尺寸,并且只想在缩略图上点击缩略图然后更新上面的div(class =“big-img”)中的链接或留下评论。

//它会按你的意愿工作

<body>
    <div class = "big-img"> <!-- set class to show big size image-->
        <?php if(isset($_GET['img'])): ?>
            <img src="city/.<?php echo $_GET['img']; ?>" alt="">
        <?php endif; ?> 
    </div>
     <table>
        <tr><!-- set class to show small size image-->
            <td class = "small"><a href="?img=img23.jpg"><img src="city/img23.jpg" alt=""></a></td>
            <td class = "small"><a href="?img=img24.jpg"><img src="city/img24.jpg" alt=""></a></td>
            <td class = "small"><a href="?img=img25.jpg"><img src="city/img25.jpg" alt=""></a></td>
        </tr>
     </table>
</body>
© www.soinside.com 2019 - 2024. All rights reserved.