View Full Version : Paginate images scanned from directory

02-21-2012, 10:03 PM
Hello there,
i got this snippet for gettin all images from a directory but, i need to add pagination on it. A simple one, just to not mess up my design if will be found more then X images on the folder.
Or, if can add a limit for images. To display only XX images randomly, or newest.
The snippet is this:

$string =array();
$dir = opendir($filePath);
while ($file = readdir($dir)) {
if (preg_match('/.jpg/i', $file) || preg_match('/.gif/i', $file) || preg_match('/.png/i', $file)) {
$string[] = $file;
while (sizeof($string) != 0){
$img = array_pop($string);
echo "<a class='lightbox-image' style='margin-bottom:5px;' href=".$filePath.$img." data-gal='prettyPhoto[gallery2]'>
<img src=".$filePath.$img." width='150' height='100'>


Thank you in advance!

02-21-2012, 11:38 PM
might look at...

02-23-2012, 08:09 PM
might look at...

Thank you for your reply but, i have a paginations script that works with database, getts rows from db and show only some of them. What i need is a pagination script to work with the script submited at the first post.
I'm not a pro on php so, sorry for my noob questions :D

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum