Jump to content

Recommended Posts

I want to select images from a directory and paginate them so I can call something similar to images.php?stack=2 and have the set images displayed (7-12 for example)...

 

<?php
$stack 1[] = "/images/01.jpg";
$stack 1[] = "/images/02.jpg";
$stack 1[] = "/images/03.jpg";
$stack 1[] = "/images/04.jpg";

$stack 2[] = "/images/05.jpg";
$stack 2[] = "/images/06.jpg";
$stack 2[] = "/images/07.jpg";
$stack 2[] = "/images/08.jpg";

if ($_GET['stack'] == 1)
{for ($i = 0; $i < 4; $i ++)
    {echo "<img src='{$stack1[$i]}'/>";
    }
}
elseif ($_GET['stack'] == 2)
{for ($i = 0; $i < 4; $i ++)
    {echo "<img src='{$stack2[$i]}'/>";
    }
}
?>

 

That basically should do the job :)

I want the script to look through a directory and list images from that...

An array would not work with what I need to do, due to the fact that I am trying to create a dynamic gallery which I don't want to have to go through constantly and update when I upload a new image...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.