SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Browsing Image

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have a load of images that I want to display on my website, each one on it's own page. Each page must have a:

    [LAST] 1 2 3 4 5 6 (etc.) [NEXT]

    I could just create a page for each image but this would be messy and I also want to be able to add new images without having to updated every page with a new image page number.

    Is there any easy way to do this?

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Richie...

    PHP (or any other scripting language) would be perfect for your needs. You could also use Javascript.

    Check out some of these links:
    PHP:
    http://www.hotscripts.com/PHP/Script...age_Galleries/

    Javascript:
    http://www.hotscripts.com/JavaScript...Image_Effects/

    ASP:
    http://www.hotscripts.com/ASP/Script...age_Galleries/

    PERL:
    http://www.hotscripts.com/Perl/Scrip...age_Galleries/
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks alot!

  4. #4
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's some PHP code that should work.. Just to get the concept across.. I'm sure other code could look a lot prettier
    PHP Code:
    <?

    $pics 
    = array(
    => "somepic1.jpg",
    => "somepic2.jpg",
    => "somepic3.jpg"
    );


    if (isset(
    $id))
    {
       echo 
    "<img src=\"$pics[$id]\"><br>\n";

       if (
    $id != 1)
       {
          
    ?><a href="<?echo $PHP_SELF;?>?id=<?echo $id-1;?>">Previous</a><?
       
    }
    }


    while (list (
    $pic_id$pic) = each($pics)) {
       if (
    $id == $pic_id)
       {
          print 
    $id ";
       } else {
          print (
    " <a href=\"$PHP_SELF?id=$pic_id\">$pic_id</a> ");
       }
    }

    if (isset(
    $id))
    {
       if (
    $id != sizeof($pics))
       {
          
    ?><a href="<?echo $PHP_SELF;?>?id=<?echo $id+1;?>">Next</a><?
       
    }
    }

    ?>


Bookmarks

Posting Permissions

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