0

Hi am having trouble figuring this out as I'm fairly new to php got it to open the dir but now I'm having trouble with the getimagesize() function here is the code

<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>

and the error im getting is:

Warning: getimagesize(images20140509_135116.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home4/downsys/public_html/galleria/paulbange/index.php on line 22

i get the same error for every pic its trying to load

you can see whats going on at www.allwhite.com/galleria/paulbange/index.php

Tamil Selvan C
  • 19,913
  • 12
  • 49
  • 70

1 Answers1

0

Simple missing slash in the directory. Change:

$directory_file = $directory . $file;

to

$directory_file = $directory .'/'. $file;
John Green
  • 13,241
  • 3
  • 29
  • 51