Results 1 to 3 of 3

Thread: Need help with script

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    68

    Need help with script

    Please help. The script below displays photos from three folders in a
    horizontal format. What I need the script to do is display the images in
    vertical format. For example Folder one contains images1 and 2. Folder three
    contains images 3 and 4 and folder3 contains images 5 and 6. Now the images
    should appear as follows.

    Column1 Column2 Column3
    -----------------------------------
    Image1 Image3 Image 5
    Image2 Image4 Image 6

    Thanks for the help.


    <?php

    $images1 = "image_gallery/column1/"; # Location of small versions
    $big = "big/"; # Location of big versions (assumed to be a subdir of
    above)
    $cols = 3; # Number of columns to display

    if ($handle = opendir($images1)) {
    while (false !== ($file1 = readdir($handle))) {
    if ($file1 != "." && $file1 != ".." && $file1 != rtrim($big,"/")) {
    $files1[] = $file1;
    }
    }
    closedir($handle);
    }


    $colCtr = 0;

    echo '<table width="100%" cellspacing="3"><tr>';

    foreach($files1 as $file1)
    {
    if($colCtr %$cols == 0)

    echo '</tr><tr><td colspan="2"><hr /></td></tr><tr>';
    echo '<td align="center"><a href="' . $images1 . $big . $file1 . '"><img
    src="' . $images1 . $file1 . '" /></a></td>';
    $colCtr++;
    }




    $images2 = "image_gallery/column2/"; # Location of small versions
    $big = "big/"; # Location of big versions (assumed to be a subdir of
    above)
    $cols = 3; # Number of columns to display

    if ($handle = opendir($images2)) {
    while (false !== ($file2 = readdir($handle))) {
    if ($file2 != "." && $file2 != ".." && $file2 != rtrim($big,"/")) {
    $files2[] = $file2;
    }
    }
    closedir($handle);
    }



    $colCtr = 0;

    echo '<table width="100%" cellspacing="3"><tr>';

    foreach($files2 as $file2)
    {
    if($colCtr %$cols == 0)
    echo '</tr><tr><td colspan="2"><hr /></td></tr><tr>';
    echo '<td align="center"><a href="' . $images2 . $big . $file2 . '"><img
    src="' . $images2 . $file2 . '" /></a></td>';
    $colCtr++;
    }







    $images3 = "image_gallery/column3/"; # Location of small versions
    $big = "big/"; # Location of big versions (assumed to be a subdir of
    above)
    $cols = 3; # Number of columns to display

    if ($handle = opendir($images3)) {
    while (false !== ($file3 = readdir($handle))) {
    if ($file3 != "." && $file3 != ".." && $file3 != rtrim($big,"/")) {
    $files3[] = $file3;
    }
    }
    closedir($handle);
    }

    $colCtr = 0;

    echo '<table width="100%" cellspacing="3"><tr>';

    foreach($files3 as $file3)
    {
    if($colCtr %$cols == 0)
    echo '</tr><tr><td colspan="2"><hr /></td></tr><tr>';
    echo '<td align="center"><a href="' . $images3 . $big . $file3 . '"><img
    src="' . $images3 . $file3 . '" /></a></td>';
    $colCtr++;
    }

    echo '</table>' . "\r\n";

  2. #2
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Re: Need help with script

    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td scope="col"><div align="center">Column 1 </div></td>
    <td scope="col"><div align="center">Column 2 </div></td>
    <td scope="col"><div align="center">Column 3 </div></td>
    </tr>
    #Pics go here {
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    #}
    </table>


    I aint here to tell you how to do it... only to show you a way...
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    68

    Re: Need help with script

    It works, thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width