Jump to content

Paginate


DWillett

Recommended Posts

Hi, I need some help with paginate. The current folder/Directory contains images, the following code arranges them in a frame. I need to paginate them and have no idea how to do this. I would like maximum 12 images showing then "Next/Prev" etc.

Can you help?

 

<?php
//path to directory to scan. i have included a wildcard for a subdirectory

$directory = "";


//get all image files with a .jpg extension.

$images = glob("" . $directory . "*.jpg");


$imgs = '';

// create array

foreach($images as $image){ $imgs[] = "$image"; }


//shuffle array

//shuffle($imgs);


//select first 12 images in randomized array

$imgs = array_slice($imgs, 0, 150);


//display images

foreach ($imgs as $img) {
    echo "<a href=\"$img\" target=\"inner\"><img src='$img' width=\"80\" border=\"1\"/></a> ";


}
?>

Link to comment
Share on other sites

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.