simple image gallery help

The code below works well and shows all the images in a folder in reverse chronological order. But I want to limit it to a certain number of images . This would enable me to have several pages of images.

So the first page would display the latest 50 images, the second page would show 50-100, and the third, 100-150.

Any helps on how to modify? I can create the pages manually. I just want to know how to limit the current page to a certain range.
[php]<?php

//Your folder
$files = glob(“images/.”);

function sortnewestfilesfirst($a, $b) {
return filemtime($b) - filemtime($a);
}
usort($files, “sortnewestfilesfirst”);

$colCnt=0;
echo ‘

’;

for ($i=0; $i<count($files); $i++)
{
$colCnt++;
if ($colCnt==1)
echo ‘

’;
echo ‘’;

if ($colCnt==6)
{
echo ‘

’;
$colCnt=0;
}
}

echo ‘

’;

$num = $files[$i];

echo ’

'."  ";

echo ‘

’;
?>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service