Make glob case insensitive

This commit is contained in:
2016-04-19 22:01:04 +01:00
parent 821bf762a4
commit e409abc2f7

View File

@@ -55,7 +55,7 @@ $oConsole
// Loop over files // Loop over files
$aGallery['title'] = ucwords(str_replace('-', ' ', substr($sGallery, 5))); $aGallery['title'] = ucwords(str_replace('-', ' ', substr($sGallery, 5)));
$aPhotos = $aLongitude = $aLatitude = []; $aPhotos = $aLongitude = $aLatitude = [];
foreach (glob($sDir . '/*.jpg') as $i => $sFile) { foreach (glob($sDir . '/*.[jJ][pP][gG]') as $i => $sFile) {
// Generate id from file contents // Generate id from file contents
$sId = substr(sha1_file($sFile), 0, 7); $sId = substr(sha1_file($sFile), 0, 7);
$oOutput->write('<info>' . $sId . '</info>'); $oOutput->write('<info>' . $sId . '</info>');
@@ -215,10 +215,12 @@ $oConsole
} }
// Write datafile // Write datafile
if (isset($oDate)) {
$aGallery['date'] = $oDate->format('Y-m-d'); $aGallery['date'] = $oDate->format('Y-m-d');
if ($oDate->diff($oEndDate)->d > 0) { if ($oDate->diff($oEndDate)->d > 0) {
$aGallery['end_date'] = $oEndDate->format('Y-m-d'); $aGallery['end_date'] = $oEndDate->format('Y-m-d');
} }
}
if (count($aLongitude) > 0) { if (count($aLongitude) > 0) {
$aGallery['map'] = [ $aGallery['map'] = [
'latitude' => array_sum($aLatitude) / count($aLatitude), 'latitude' => array_sum($aLatitude) / count($aLatitude),