dynamically load shadowbox gallery images from folders using php

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

dynamically load shadowbox gallery images from folders using php

melaniebund
This post was updated on .
Hi
i would like to dynamically load shadowbox gallery from thumbs and original images folders using php - with the code below i get an error message - any ideas what is  wrong or do you know one that works?

<?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 '<img src="', str_replace($gallery_up_dir,$gallery_thumb_dir,$img) ,'" />';

}?>

thanks
melanie