diff --git a/core/module/install/view/index/index.css b/core/module/install/view/index/index.css new file mode 100644 index 00000000..1cd24778 --- /dev/null +++ b/core/module/install/view/index/index.css @@ -0,0 +1,17 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + + + +@import url("core/layout/admin.css"); \ No newline at end of file diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index b9055b83..4922d356 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -39,8 +39,11 @@ class gallery extends common { public static $pictures = []; - const GALLERY_VERSION = '2.0'; + public static $thumbs = []; + const THUMBS_SEPARATOR = 'mini_'; + + const GALLERY_VERSION = '2.0'; public function filter() { @@ -116,11 +119,24 @@ class gallery extends common { self::filter(); } else { $galleryId = helper::increment($this->getInput('galleryConfigName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0)])); + // La première image est celle de la couverture de l'album + $directory = $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true); + $iterator = new DirectoryIterator($directory); + foreach($iterator as $fileInfos) { + if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) { + // Miniatures + $homePicture = file_exists( str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())) + ? self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()) + : strtolower($fileInfos->getFilename()); + break; + } + } + $this->setData(['module', $this->getUrl(0), $galleryId, [ 'config' => [ 'name' => $this->getInput('galleryConfigName'), 'directory' => $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true), - 'homePicture' => '', + 'homePicture' => $homePicture, 'sort' => $this->getInput('galleryConfigSort'), 'position' => count($this->getData(['module',$this->getUrl(0)])) + 1 ], @@ -225,16 +241,13 @@ class gallery extends common { $legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT); } // Photo de la page de garde de l'album - $homePictures = []; - foreach((array) $this->getInput('homePicture', null) as $file => $homePicture) { - // null : pas de variable définie (compatibilité) ou choix non effectif - $homePictures[$file] = $file === 0 ? null : helper::filter($file, helper::FILTER_STRING_SHORT) ; - } + $homePicture = array_keys($this->getInput('homePicture', null)); + // Sauvegarder $this->setData(['module', $this->getUrl(0), $galleryId, [ 'config' => [ 'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true), 'directory' => $this->getInput('galleryEditDirectory', helper::FILTER_STRING_SHORT, true), - 'homePicture' => $homePictures[$file], + 'homePicture' => $homePicture[0], 'sort' => $this->getInput('galleryEditSort'), 'position' => count($this->getData(['module',$this->getUrl(0)])) + 1 ], @@ -309,6 +322,10 @@ class gallery extends common { 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', str_replace('.','',$fileInfos->getFilename())]); + // Miniatures + self::$thumbs[$directory . '/' . $fileInfos->getFilename()] = file_exists( str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())) + ? str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()) + : str_replace('source','thumb',$directory) . '/' . strtolower($fileInfos->getFilename()); } } // Tri des images par ordre alphabétique @@ -363,7 +380,9 @@ class gallery extends common { foreach($iterator as $fileInfos) { if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) { self::$galleries[$galleryId] = $gallery; - self::$firstPictures[$galleryId] = $gallery['config']['directory'] . '/' . $fileInfos->getFilename(); + self::$firstPictures[$galleryId] = file_exists( str_replace('source','thumb',$gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture'])) + ? str_replace('source','thumb',$gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']) + : str_replace('source','thumb',$gallery['config']['directory']) . '/' . strtolower($gallery['config']['homePicture']); continue(2); } } diff --git a/module/gallery/view/gallery/gallery.php b/module/gallery/view/gallery/gallery.php index 6dde60ee..dec20640 100644 --- a/module/gallery/view/gallery/gallery.php +++ b/module/gallery/view/gallery/gallery.php @@ -18,7 +18,7 @@ diff --git a/module/gallery/view/index/index.php b/module/gallery/view/index/index.php index 49126f56..707c330d 100644 --- a/module/gallery/view/index/index.php +++ b/module/gallery/view/index/index.php @@ -9,13 +9,7 @@