ramyers1987
New member
folder? So I went on a trip to Hawaii Japan and China, and want to write a php script that will simply display each of my thumbnail images on a webpage, and then I will use Lightbox to bring up the full size image, or have the full resolution image pop up in a new window.
My question is how will I set up a php array on over 1000 pictures, that would change as I remove or add pictures? The code I have is this, but im not exactly sure how it works:
<?php
Header("content-type: application/x-javascript");
function returnimages($dirname=".") {
$pattern="\.(jpg|jpeg|png|gif|bmp)$";
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){
$filedate=date ("M d, Y H:i:s", filemtime($file));
echo 'galleryarray[' . $curimage .']=["' . $file . '", "'.$filedate.'"];' . "\n";
$curimage++;
}
}
closedir($handle);
}
return($files);
}
echo "var galleryarray=new Array();" . "\n";
returnimages();
?>
Thanks for the help everyone!
My question is how will I set up a php array on over 1000 pictures, that would change as I remove or add pictures? The code I have is this, but im not exactly sure how it works:
<?php
Header("content-type: application/x-javascript");
function returnimages($dirname=".") {
$pattern="\.(jpg|jpeg|png|gif|bmp)$";
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){
$filedate=date ("M d, Y H:i:s", filemtime($file));
echo 'galleryarray[' . $curimage .']=["' . $file . '", "'.$filedate.'"];' . "\n";
$curimage++;
}
}
closedir($handle);
}
return($files);
}
echo "var galleryarray=new Array();" . "\n";
returnimages();
?>
Thanks for the help everyone!