Creating image gallery

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • krunkelgarten

    Creating image gallery

    Hi there,

    I'm trying to create a fully automatic image gallery. I already have
    the page
    that automatically creates the index of thumbnails.

    What i want now, is to create a page which indexes which galleries
    there are;
    each gallery is in a folder, so it has to check for folders, and if it
    excists
    automatically grab the first thumbnail, and put it in a table, and it
    puts the
    name of the gallery/folder beneath it.

    I already got this far, but what i want, is that you get 4 thumbnails
    next to
    each other, and then automatically the next row.

    What i have is the next code:

    <?php

    $the_array = Array();
    $handle = opendir('.');

    while (false !== ($file = readdir($handle ))) {
    if ($file != "." && $file != ".." && $file != "index.php" ) { /* as
    descripted below: these "files" will not be added to the array */
    $the_array[] = $file;
    }
    }
    closedir($handl e);

    foreach ($the_array as $element) {
    echo "<table width=104 height=104 border=0 cellpadding=0
    cellspacing=0 class=pictable>
    <tr>

    <td align=center valign=middle>< a href=./$element target=_self
    onFocus=this.bl ur()><img src=./$element/tmb/01.gif alt=$element
    width=90 height=90 border=0></a></td>
    </tr>
    </table>";} ?>


    So every gallery has the same structure: index.php, and 2 folders; pix
    & tmb

    What i want is:
    _______________ _______________ ___
    | | | | | | | |
    | | | | | | | |
    | img | | img | | img | | img |
    | | | | | | | |
    _______________ _______________ ___
    _______________ _______________ ___
    | | | | | | | |
    | | | | | | | |
    | img | | img | | img | | img |
    | | | | | | | |
    _______________ _______________ ___

    Hope this is clear:

    I only want a table, if there is a folder.
    Between every table, i want a column, so the 4
    images are equally spread.

    Sorry for the long question...

    Greetz Krunkelgarten
  • Bob

    #2
    Re: Creating image gallery

    Hi, as far as i understand you wanna to display photos 4 X 2 in a
    table?!
    It's pretty simple, here is example how to display 3 X 3 you can see
    it at http://haifa.us.
    $arr_len=count( $picsArr);
    echo "<table cellspacing=\"2 \" cellpadding=\"2 \" border=\"0\"
    width=100%>";
    echo "<tr>";
    for($i=0; $i<$arr_len;$i+ +){
    if(is_string($p icsArr[$i]))
    echo "<td><div class=\"present ation\">".$pics Arr[$i]."</div></td>";

    this is most important part, it's close </tr> row on specific number,
    for example on photo number 3(0,1,2) the first row will be created and
    you'll go to row #2!
    if($i==2 || $i==5 || $i==8)
    echo"</tr><tr>";
    }



    let me kno if you have any questions!


    krunkelgarten@h otmail.com (krunkelgarten) wrote in message news:<8767e62e. 0312290401.13ea 21e7@posting.go ogle.com>...[color=blue]
    > Hi there,
    >
    > I'm trying to create a fully automatic image gallery. I already have
    > the page
    > that automatically creates the index of thumbnails.
    >
    > What i want now, is to create a page which indexes which galleries
    > there are;
    > each gallery is in a folder, so it has to check for folders, and if it
    > excists
    > automatically grab the first thumbnail, and put it in a table, and it
    > puts the
    > name of the gallery/folder beneath it.
    >
    > I already got this far, but what i want, is that you get 4 thumbnails
    > next to
    > each other, and then automatically the next row.
    >
    > What i have is the next code:
    >
    > <?php
    >
    > $the_array = Array();
    > $handle = opendir('.');
    >
    > while (false !== ($file = readdir($handle ))) {
    > if ($file != "." && $file != ".." && $file != "index.php" ) { /* as
    > descripted below: these "files" will not be added to the array */
    > $the_array[] = $file;
    > }
    > }
    > closedir($handl e);
    >
    > foreach ($the_array as $element) {
    > echo "<table width=104 height=104 border=0 cellpadding=0
    > cellspacing=0 class=pictable>
    > <tr>
    >
    > <td align=center valign=middle>< a href=./$element target=_self
    > onFocus=this.bl ur()><img src=./$element/tmb/01.gif alt=$element
    > width=90 height=90 border=0></a></td>
    > </tr>
    > </table>";} ?>
    >
    >
    > So every gallery has the same structure: index.php, and 2 folders; pix
    > & tmb
    >
    > What i want is:
    > _______________ _______________ ___
    > | | | | | | | |
    > | | | | | | | |
    > | img | | img | | img | | img |
    > | | | | | | | |
    > _______________ _______________ ___
    > _______________ _______________ ___
    > | | | | | | | |
    > | | | | | | | |
    > | img | | img | | img | | img |
    > | | | | | | | |
    > _______________ _______________ ___
    >
    > Hope this is clear:
    >
    > I only want a table, if there is a folder.
    > Between every table, i want a column, so the 4
    > images are equally spread.
    >
    > Sorry for the long question...
    >
    > Greetz Krunkelgarten[/color]

    Comment

    Working...