Is there anyway to preload all the images from one directory? vs. typing each file name in on a preload script?
I was reading up on the Directory functions , but haven't found what I'm looking for.
Preloading a directory
Moderator: General Moderators
i wrote a script to automatically build a thumbnail table of all the images in a given directory.... a few snippets from that and you get this, which should do what you're asking for....
this will only print the name of the image, but that can be replaced with your javascript statement for each image. you can also edit it to work with whatever extensions you want (currently is only *.jpg and *.gif). the present script will also require a full path to the directory... adding a little $DOCUMENT_ROOT would fix that.
if that's not what you need, lemme know.
Code: Select all
function preload_dir($dir)
{
$d = dir($dir);
#echo "Handle: ".$d->handle."<br>\n";
#echo "Path: ".$d->path."<br>\n";
while (false !== ($entry = $d->read())) {
// edit statement below to include desired extensions
if (ereg("((jpg)|(gif))$i",$entry)) {
// edit this to print whatever
// javascript will do the preload trick
echo $entry."<br>\n";
}
}
$d->close();
}if that's not what you need, lemme know.
feed me!
Could you please let me see your script for the thumbnails, I've been looking for something like that that doesn't use GD library.
But still in the topic, how can I build a page that I can actually se the preload in action, how can I tell if it is really working?
But still in the topic, how can I build a page that I can actually se the preload in action, how can I tell if it is really working?