DWillett Posted June 15, 2012 Share Posted June 15, 2012 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> "; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/264242-paginate/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.