automatically generate gallery with shadowbox

Hi
Can anyone help?
i have a code to automatically generate a slideshow from thumbs and originals folders which deos not seem to be working - i get error
Warning: Invalid argument supplied for foreach() in /home/content/33/5055733/html/galeria.php on line 89
the code is below
[php]<?php
$gallery_up_dir = “gallery_uploads”;
$gallery_thumb_dir = “gallery_thumbs”;
$directory = “$gallery_up_dir/*/”;

// or get all image files with a .jpg, .JPG, .png, .PNG extension.
$extensions_array = array(‘jpg’, ‘JPG’, ‘png’, ‘PNG’);

$imageArray = array();
foreach($extensionsArray as $ext){
$images = glob("" . $directory . “*.$ext”);

// fill up the array
foreach($images as $image){ 
    $imageArray[] = "$image"; 
}

}

//display images
foreach ($imageArray as $img) {

 echo '<a href="',$img,'" rel="shadowbox" class="thumbnail"><img src="', 
       str_replace($gallery_up_dir,$gallery_thumb_dir,$img) ,'" /></a>';

}?>[/php]

thanks in advance
melanie

$extensions_array

$extensionsArray

Do you see the problem?

thanks alot
melanie

only problem now is that the code does not work - supposed to dynamically generate a gallery from folders but i just get a blank page
any ideas?
thanks
melanie

solved it! see code below[php]<?php
$gallery_up_dir = “gallery_uploads”;
$gallery_thumb_dir = “gallery_thumbs”;

// or get all image files with a .jpg, .JPG, .png, .PNG extension.
$extensions_array = array(‘jpg’, ‘JPG’, ‘png’, ‘PNG’);

$imageArray = array();
foreach($extensions_array as $ext){
// $images = glob("" . $directory . “".$ext);
$images = glob($gallery_up_dir."/
”.$ext);

// fill up the array
foreach($images as $image){ 
    $imageArray[] = $image; 
}

}

//display images
foreach ($imageArray as $img) {
$parts = explode("/", $img);
$thumb = $parts[1];

	    echo '<a href="'.$img.'" rel="shadowbox[Galeria]" class="thumbnail"><img src="'. 
      $gallery_thumb_dir.'/'.$thumb.'" /></a>';

}?>[/php]

Good job 8)

The code is really useful, it helped me too. Thanks dear.

Sponsor our Newsletter | Privacy Policy | Terms of Service