function load_dir_to_array in Brilliant Gallery 7
Same name and namespace in other branches
- 5.4 brilliant_gallery.module \load_dir_to_array()
- 5.3 brilliant_gallery.module \load_dir_to_array()
- 6.4 functions.inc \load_dir_to_array()
- 6 brilliant_gallery.module \load_dir_to_array()
- 6.3 functions.inc \load_dir_to_array()
- 7.2 OLD_brilliant_gallery_functions.inc \load_dir_to_array()
2 calls to load_dir_to_array()
- render_brilliant_gallery in ./brilliant_gallery_showtime.inc
- render_brilliant_gallery_manage in ./brilliant_gallery_manage.inc
File
- ./brilliant_gallery_functions.inc, line 14
Code
function load_dir_to_array($absolpath, $imagewidth, $fullresolutionmaxwidth, $brilliant_gallery_sort, $imagecrop, $maximumnumbertoshow = '') {
$poct = -1;
$retval_dimensions = array();
$actualpath = realpath(FILE_DIRECTORY_PATH) . $absolpath;
$handle = @opendir($actualpath);
$imagemaxh = 0;
$hidden_file_names = brilliant_gallery_get_picasa_hidden_imagenames($actualpath);
$filearray = array();
while ($file = @readdir($handle)) {
if (!brilliant_gallery_testext($file)) {
continue;
}
if (in_array($file, $hidden_file_names)) {
continue;
}
$filearray[] = $file;
}
@closedir($handle);
if (empty($filearray)) {
watchdog('Brilliant Gal', 'No displayable images in ' . $absolpath . '!');
}
else {
foreach ($filearray as $file) {
$poct += 1;
$retval_dimensions[$poct]['file'] = $file;
$retval_dimensions[$poct]['imgcrop'] = $imagecrop;
$temp = getimagesize($actualpath . '/' . $file);
if ($temp === false) {
continue;
}
if ($temp[0] - $temp[1] >= 0 or $maximumnumbertoshow == 1) {
if ($imagecrop == 'yes') {
$retval_dimensions[$poct]['imgw'] = $imagewidth;
$retval_dimensions[$poct]['imgh'] = $imagewidth;
}
else {
$retval_dimensions[$poct]['imgw'] = $imagewidth;
$retval_dimensions[$poct]['imgh'] = round($temp[1] / $temp[0] * $imagewidth);
}
$retval_dimensions[$poct]['imgwbig'] = $fullresolutionmaxwidth;
$retval_dimensions[$poct]['imghbig'] = round($temp[1] / $temp[0] * $fullresolutionmaxwidth);
}
else {
if ($imagecrop == 'yes') {
$retval_dimensions[$poct]['imgw'] = round($temp[0] / $temp[1] * $imagewidth);
$retval_dimensions[$poct]['imgh'] = $imagewidth;
}
else {
$retval_dimensions[$poct]['imgw'] = round($temp[0] / $temp[1] * ($temp[0] / $temp[1]) * $imagewidth);
$retval_dimensions[$poct]['imgh'] = round($temp[0] / $temp[1] * $imagewidth);
}
$retval_dimensions[$poct]['imgwbig'] = round($temp[0] / $temp[1] * ($temp[0] / $temp[1]) * $fullresolutionmaxwidth);
$retval_dimensions[$poct]['imghbig'] = round($temp[0] / $temp[1] * $fullresolutionmaxwidth);
}
if ($imagemaxh < $retval_dimensions[$poct]['imgh']) {
$imagemaxh = $retval_dimensions[$poct]['imgh'];
}
}
}
if ($brilliant_gallery_sort == '1') {
@sort($retval_dimensions);
}
else {
shuffle($retval_dimensions);
}
return array(
$retval_dimensions,
$imagemaxh,
);
}