制作照片弹出窗

时间:2016-03-15 00:21:37

标签: php jquery html css

我正试图让这些照片弹出来点击。照片是从两个目录中提取的。您看到的第一张照片来自拇指目录,我想在点击拇指时显示原始目录中的完整照片。

这是我的代码:

$images_dir = 'images/med/full/';
$thumbs_dir = 'images/med/thumb/';
$thumbs_width = 300;
$thumbs_height = 300;
$images_per_row = 3;

/** generate photo gallery **/
$image_files = get_files($images_dir);
if(count($image_files)) {
$index = 0;
foreach($image_files as $index=>$file) {
    $index++;
    $thumbnail_image = $thumbs_dir.$file;
    if(!file_exists($thumbnail_image)) {
        $extension = get_file_extension($thumbnail_image);
        if($extension) {
            make_thumb  ($images_dir.$file,$thumbnail_image,$thumbs_width,$thumbs_height);
        }
    }
    echo '<a href="',$images_dir.$file,'" class="photo-link smoothbox" rel="gallery"><img src="',$thumbnail_image,'" /></a>';
    if($index % $images_per_row == 0) { echo '<div class="clear"></div>'; }
}
echo '<div class="clear"></div>';
}
else {
    echo '<p>There are no images in this gallery.</p>';
}

?>

我正在使用Smoothbox,但我无法让它发挥作用。我希望我能写一个较小的脚本,而不是使用上面链接中的脚本。

我研究过创建一个简单的灯箱,例如this one here,但我不确定如何将它与我上面的代码集成。

以下是我想要将其用于我的照片的网站链接:http://davishosting.net/ginger/mediterranean

我是PHP的新手,我非常喜欢学习编码语言!我一直在努力学习这个目标。我希望照片放大并居中,背后的一切都有半透明的背景。我熟悉在CSS中使用rgba来制作透明背景。

0 个答案:

没有答案