[10.0.20.dev} Pb nommage légendes dans galeries

This commit is contained in:
fredtempez 2019-10-05 13:36:52 +02:00
parent 9526ac1e57
commit 21c63e337c
2 changed files with 9 additions and 8 deletions

View File

@ -360,9 +360,9 @@ class init extends common {
'directory' => self::FILE_DIR.'source/galerie/landscape'
],
'legend' => [
'desert.jpg' => 'Un désert',
'iceberg.jpg' => 'Un iceberg',
'meadow.jpg' => 'Une prairie'
'desertjpg' => 'Un désert',
'icebergjpg' => 'Un iceberg',
'meadowjpg' => 'Une prairie'
]
],
'espace' => [
@ -371,9 +371,9 @@ class init extends common {
'directory' => self::FILE_DIR.'source/galerie/space'
],
'legend' => [
'earth.jpg' => 'La Terre et la Lune',
'cosmos.jpg' => 'Le cosmos',
'nebula.jpg' => 'Une nébuleuse'
'earthjpg' => 'La Terre et la Lune',
'cosmosjpg' => 'Le cosmos',
'nebulajpg' => 'Une nébuleuse'
]
]
],

View File

@ -167,6 +167,7 @@ class gallery extends common {
}
$legends = [];
foreach((array) $this->getInput('legend', null) as $file => $legend) {
$file = str_replace('.','',$file);
$legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT);
}
@ -193,7 +194,7 @@ class gallery extends common {
self::$pictures[$fileInfos->getFilename()] = [
$fileInfos->getFilename(),
template::text('legend[' . $fileInfos->getFilename() . ']', [
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'legend', $fileInfos->getFilename()])
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'legend', str_replace('.','',$fileInfos->getFilename())])
])
];
}
@ -230,7 +231,7 @@ class gallery extends common {
$iterator = new DirectoryIterator($directory);
foreach($iterator as $fileInfos) {
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'legend', $fileInfos->getFilename()]);
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'legend', str_replace('.','',$fileInfos->getFilename())]);
}
}
// Tri des images par ordre alphabétique