Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorbitmap
    • CommentTimeJun 27th 2006
     
    Hi,
    is it possible to see all the pictures in a folder ?
  1.  
    http://www.frwrd.net/minishowcase/
    • CommentAuthormarkezz
    • CommentTimeJul 6th 2006 edited
     
    <p>If you're already working with lightbox2 and you have the opportunity to work with php on your webspace I'd suggest the following (imho easier) solution:</p>
    <p>include a simple php-function in your php-page:<br />
    <code>
    &lt;?php<br />
    function createLbFromDir ($linkname, $galname, $directory, $extensions = array ('jpg', 'jpeg')) {<br />
    &nbsp;&nbsp;$gallery = "";<br />
    &nbsp;&nbsp;$dh = opendir ($directory);<br />
    &nbsp;&nbsp;while ($file = readdir ($dh)) {<br />
    &nbsp;&nbsp;&nbsp;&nbsp;$parts = explode(".", basename ($file));<br />
    &nbsp;&nbsp;&nbsp;&nbsp;$extension = $parts[count($parts)-1];<br />
    &nbsp;&nbsp;&nbsp;&nbsp;if (!is_dir ($directory . $file) && ($file != ".." && $file != ".") && in_array($extension, $extensions)) {<br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($gallery == "")<br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$gallery.= "&lt;a href=\"".$directory.$file."\" rel=\"lightbox[".$galname."]\"&gt;".$linkname."&lt;/a&gt;";<br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$gallery.= "&lt;a href=\"".$directory.$file."\" rel=\"lightbox[".$galname."]\"&gt;&lt;/a&gt;";<br />
    &nbsp;&nbsp;&nbsp;&nbsp;}<br />
    &nbsp;&nbsp;}<br />
    &nbsp;&nbsp;return $gallery;<br />
    }<br />
    ?&gt;<br />
    </code>
    </p>
    <p>and use it in the appropriate place like:<br />
    <code>
    &lt;?php echo createLbFromDir ("My Gallery", "gal_one", "./path/to/dir/"); ?&gt;<br />
    </code>
    </p>
    <p>include another directory as a different gallery on the same page:<br />
    <code>
    &lt;?php echo createLbFromDir ("Other Gallery", "gal_two", "./path/to/other/dir/"); ?&gt;<br />
    </code>
    </p>
    I hope this will help....
  2.  
    @igeoffi: your link doesn't work... :(

    @markezz: sorry, what should this php code do? Should it add automatically all images (even if the images have different names or extension, for example mountain.jpg or sky.png) to a lightbox gallery?
    Thanks for the attention.
    • CommentAuthormarkezz
    • CommentTimeJul 7th 2006
     
    <p>@mdt: this php-function grabs all images (defined by the $extensions-list) from a directory and adds them automatically to a lightbox gallery. actually it creates an imagelist for a lightbox gallery</p>
    <p>to add png support you have to use the $extensions parameter:<br />
    <code>
    &lt;?php echo createLbFromDir ("My Gallery", "gal_one", "./path/to/dir/", array ("jpg", "jpeg", "png")); ?&gt;
    </code>
    </p>
  3.  
    @markezz

    thanks for your great php script. i took it and changed a few things to add thumbnail loading directly from a second folder. now you can specify two folders, one for the images and one for the thumbnails. the thumbnails need to have the same name as the original images to be loaded.

    I published the script on my blog, there it's not scrambled as above:
    http://blindape.wordpress.com/2006/12/24/ajax-image-gallery-lightboxphp/