Jump to content

Loading message


son

Recommended Posts

I use to display all images on page, which are stored in dedicated folder as:

$narray = array();$dir = "Photos/full/"; // name of the folder where images are storedif (is_dir($dir)) {   $dh= @opendir($dir) or die("Unable to open $path please notify the administrator. Thank you."); // confirm directories exist   while (($file = readdir($dh)) !== false) {  // read the entire directory   	if (($file != '.') &&  ($file != '..') && (stristr($file,'jpg'))) { //jpg files only   if (file_exists($dir . $file)) {        $narray[]=$file;        $n++;        }        }   }$max_num = count(glob($dir."*.jpg"));$j=0;if ($n < $max_num) {	$max_num = $n;  // reset the max_num if not enough pictures	}echo "<ul class=\"slides\">";  while ( $j <= $max_num-1) {	echo "\t" . '<li><img src="' . $dir . $narray[$j] . '" alt="' . $dir . $narray[$j] . '" ></li> ' . "\n\r\t";	 $j++;  }}        else {

Is there a way to display a loading message/image until all images are loaded?Son

Link to comment
Share on other sites

You'll need to use JavaScript. The img element has an onload event.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...