galleria php脚本加载文件夹中的所有图片

时间:2015-04-28 19:25:37

标签: php html galleria

嗨我很难搞清楚这一点因为我是相当新的php得到它打开dir但现在我遇到问题getimagesize()函数这里是代码

<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Photo-Album Paul Bange Roofing</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery /1/jquery.js">                                                                   </script>
<script src="galleria-1.4.2.min.js"></script>
<style>
#galleria{ width: 100%; height: 100%; background: #000; }
</style>
</head>
<body>
<div id="galleria"><?php
$directory = "images";
$handle = openDir($directory); 
while ($file = readDir($handle)) { 
if ($file != "." && $file != ".." && !is_dir($file)) {
if (strstr($file, ".gif") ||
 strstr($file, ".png") ||
 strstr($file, ".jpg")) {
$directory_file = $directory . $file;
$info = getImageSize($directory_file);
echo "<img src=\"$directory_file\"";
echo " width=\"$info[0]\" height=\"$info[1]\"> <br>\n";
}
}
}
closeDir($handle);
?>
</div>
<script>
Galleria.loadTheme('themes/classic/galleria.classic.min.js');
Galleria.configure({
transition: 'fadeslide',
fullscreenDoubleTap: true,
imageCrop: false,
trueFullscreen: true,
imagePan: true,
responsive: true,
swipe: true,
imagePosition: 'center',
showInfo: true,
fullscreenCrop: 'landscape',
initialTransition: 'fade'


});

Galleria.ready(function() {
this.bind('image', function(e) {
    $(e.imageTarget).bind('contextmenu', function(f) {
        f.preventDefault();

        return false;
    }).bind('dragstart', function(f) {

        return false;
    });;
    });
});

Galleria.run('#galleria');
</script>
</body>
</html>

错误即时获取:

  

警告:getimagesize(images20140509_135116.jpg)[function.getimagesize]:无法打开流:第22行/home4/downsys/public_html/galleria/paulbange/index.php中没有此类文件或目录

我尝试加载的每张照片都会出现相同的错误

您可以在www.allwhite.com/galleria/paulbange/index.php上看到最新消息

0 个答案:

没有答案