这里是我得到一个代码:如何在我的目录图片中添加链接?
<?
include "top.php";
?>
<center>
<a href='upload.php'><button>Upload Image</button></a>
</center>
<br>
<?php
$www_root = 'http://annexsecurity.x10.mx/images';
$dir = 'images/';
$file_display = array('jpg', 'jpeg', 'png', 'gif');
if (file_exists($dir) == false) {
echo 'Directory \'', $dir, '\' not found!';
} else {
$dir_contents = scandir($dir);
foreach ($dir_contents as $file) {
$file_type = strtolower(end(explode('.', $file)));
if (($file !== '.') && ($file !== '..') && (in_array($file_type, $file_display))) {
echo '<img src="', $www_root, '/', $file, '" alt="', $file, '"/>';
}
}
}
?>
<style type="text/css">
img {
height: 100;
width: 100;
float: left;
margin: 0.5em;
border: 1px solid #ccc;
padding: 1em;
font-size: 10px;
}
</style>
我所要做的是使它所以当你点击它会导致你的图像的更大版本的图像。像,完整的形象。例如,它会导致这样的事情:http://www.example.com/image.png/
有人可以帮我这个吗?这是显示图像的代码行:
echo '<img src="', $www_root, '/', $file, '" alt="', $file, '"/>';
现在,我想要链接的东西,因此它会导致更大的图像。
: – SpiderLinked
你想将用户重定向到具有比最初的一个或图像更大的页面你想在同一页面上弹出更大版本的初始图像? – SpiderLinked
您还可以通过向图像添加单击事件来实现此“效果”。 (jquery) – SpiderLinked