public function beforeRender()
{
$albumsPaths = null;
$path = 'gallery/';
$a = 0;
$albumsNames = null;
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
DIRECTORY_SEPARATOR == '/';
} else {
DIRECTORY_SEPARATOR == '\\';
}
foreach (Finder::findDirectories('*')->exclude('[0-9][0-9][0-9]', '_big')->in($path) as $key => $file) {
$albumsNames[] = str_replace("gallery" . DIRECTORY_SEPARATOR, "", $key);
$albumsPaths[] = $key;
$i = 0;
$nImg = 0;
if (($files = @scandir($key)) && count($files) <= 2) {
$albumImgs[$a] = null;
$this->template->thumbs = null;
} else {
foreach (Finder::findFiles('*.jpg', '*.png', '*.jpeg', '*.JPG', '*.PNG', '*.JPEG')->in($key) as $key2 => $file) {
$albumImgs[$a] = $file->getFilename();
$i++;
}
$this->template->thumbs = $albumImgs;
}
$a++;
}
$this->template->albumsNames = $albumsNames;
}