Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
// Set this to the directory that you want to list the images in
define('IMAGE_DIRECTORY',PATH . 'images/');
// Set this to the URL prefix required (if any).
define('URL_PREFIX', BASE_PATH . 'images/');
// Set this 'true' to look for images in subdirectories
define('RECURSIVE',true);
function echo_images_in_dir($dirname,$recurse,$prefix = '') {
if( is_dir( $dirname ) ) {
$dir = opendir($dirname);
while( FALSE !== ( $entry = readdir($dir ) ) ) {
if ($entry == '.' or $entry == '..') continue;
if (is_dir($dirname.'/'.$entry)) {
if ($recurse)
echo_images_in_dir($dirname.'/'.$entry,$recurse,$prefix.basename($entry).'/');
} elseif (is_image($dirname.'/'.$entry))
echo( '<tr valign="top"><td width="50%" align="left"><div>' . URL_PREFIX . $prefix.basename($entry) .'</div></td><td align="left"><img src = "' . URL_PREFIX . $prefix.basename($entry) . '"/></td></tr>' );
}
}
}
function is_image($filename) {
$ext = strtolower(substr($filename,-4));
return is_file($filename) and is_readable($filename) and ($ext == '.gif' or $ext == '.jpg' or $ext == '.png');
}
// then use this call:
echo_images_in_dir(IMAGE_DIRECTORY,RECURSIVE);