|
Posted by oswald on 01/23/06 05:17
i've got an array of 500 filenames (images to be exact).. i need to do
paging of the display... i can figure out how to do this with mysql, but
this i can't
here's the piece of code displaying all images on one page.. resize.php
does thumbnails on the fly.... i need those results to be 50 by page an
so on... maybe anyone can help?
$dirlist = "./";
//main
$playername=strtoupper($playername);
if ($playername == "")
{
//
-------------------------------------------------------------------------
----------------------------------------------------------------
// if no search entered, display all pictures
//
-------------------------------------------------------------------------
----------------------------------------------------------------
echo "You chose to display all available pictures.<BR><BR><BR>";
if ($alreadydone != 1) {
if (is_dir($dirlist)==true ) {
chdir( $dirlist );
$handle=opendir( ".");
}
$x=0;
$images=array();
while (($file = readdir($handle))!==false) {
$pieces = explode (".", $file);
if ($pieces[0] && $pieces[1]) {
if (($pieces[1]=="gif") || ($pieces[1]=="jpg") || ($pieces[1]=="GIF")
|| ($pieces[1]=="JPG") || ($pieces[1]=="bmp") || ($pieces[1]=="BMP") ||
($pieces[1]=="png") || ($pieces[1]=="PNG")) {
$images[$x]=$file;
$x++;
}
}
}
closedir($handle);
}
else
{
$images = unserialize(base64_decode($myArrayS));
}
// display results
for ($i=0; $i<sizeof($images); $i++)
{
?><a href="showpic.php?p=<? echo $i;?>"
target="imagewindow" onclick="window.open('showpic.php?p=<? echo $images
[$i]; ?>','imagewindow',',toolbar=no,directories=no,status=no,
menubar=no,scrollbars=yes,resizable=yes'); return false;">
<B><? echo "<img src=resize.php?filename=".$images
[$i].">";?>
<? $p_names=explode('_',$images[$i]); echo $p_names[1]."
". $p_names[2].""; ?></a>
<?
if (($i+1) % 8 == 0)
echo"<br>";
}
}
// end if display all pictures
--
oswald
gg: 7777 | I deny the current reality and substitute it with my own.
[Back to original message]
|