Your directory of \''. $dir. '\' could not be found! No images could be seen or used by ProGallery. Please carefully check the relative path is correct. Your hosting company might be able to help you.';
}
else {
$dir_contents = scandir($dir);
foreach ($dir_contents as $file) {
// Ignore images that have '@2x' or 'thumb_' in the name - we can replace these files later with our own prefixes / calls.
if (strpos($file, '_thumb') === false && strpos($file, '@2x') === false) {
$file_type = strtolower(end(explode('.', $file)));
$file_display[$file] = filemtime($dir . '/' . $file);
$filetitle = $file;
// Generate 'cleaned' image titles, with no hyphens or underscores
$filetitle = str_replace("-", " ", $filetitle);
$filetitle = str_replace("_", " ", $filetitle);
$filetitle = preg_replace('/\\.[^.\\s]{3,4}$/', '', $filetitle);
// Have some 'thumb' file names ready as variables, in case we need them a bit later
$extension_pos = strpos($file, '.'); // Find position of the last dot, so where the extension starts
$thumbnail = substr($file, 0, $extension_pos) . '_thumb' . substr($file, $extension_pos);
// Have some 'retina' file names ready as variables, in case we need them a bit later
$extension_pos = strpos($file, '.'); // Find position of the last dot, so where the extension starts
$retina = substr($file, 0, $extension_pos) . '@2x' . substr($file, $extension_pos);
arsort($files);
if ($file !== '.' && $file !== '..' && in_array($file_type, $file_display) == true) {
echo('' . $filetitle . '
');
}
}
}
}
?>