From 034bea49b2bade6b75f4bfba6f25f5ded432f82d Mon Sep 17 00:00:00 2001 From: Matthieu Leproux Date: Wed, 25 May 2022 15:56:39 +0200 Subject: [PATCH] related to #1657 svg is now considered as a file and not a picture and added file_ext and path_ext to img data sent. --- include/category_default.inc.php | 3 ++- include/config_default.inc.php | 3 +-- include/derivative.inc.php | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/category_default.inc.php b/include/category_default.inc.php index 3bf48cce4..fb37ddb1e 100644 --- a/include/category_default.inc.php +++ b/include/category_default.inc.php @@ -104,7 +104,8 @@ foreach ($pictures as $row) 'URL' => $url, 'DESCRIPTION' => $desc, 'src_image' => new SrcImage($row), - 'is_svg' => ('svg' == strtolower(get_extension($row['path']))), + 'path_ext' => strtolower(get_extension($row['path'])), + 'file_ext' => strtolower(get_extension($row['file'])), ) ); if ($conf['index_new_icon']) diff --git a/include/config_default.inc.php b/include/config_default.inc.php index e8ce95f09..98fe1daff 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -40,13 +40,12 @@ // picture_ext : file extensions for picture file, must be a subset of // file_ext -// Add 'svg' to this array to support svg images. $conf['picture_ext'] = array('jpg','jpeg','png','gif'); // file_ext : file extensions (case sensitive) authorized $conf['file_ext'] = array_merge( $conf['picture_ext'], - array('tiff', 'tif', 'mpg','zip','avi','mp3','ogg','pdf') + array('tiff', 'tif', 'mpg','zip','avi','mp3','ogg','pdf','svg') ); // enable_formats: should Piwigo search for multiple formats? diff --git a/include/derivative.inc.php b/include/derivative.inc.php index a78a6d07b..3585027d5 100644 --- a/include/derivative.inc.php +++ b/include/derivative.inc.php @@ -42,6 +42,8 @@ final class SrcImage $this->id = $infos['id']; $ext = strtolower(get_extension($infos['path'])); + $infos['file_ext'] = @strtolower(get_extension($infos['file'])); + $infos['path_ext'] = $ext; if (in_array($ext, $conf['picture_ext'])) { $this->rel_path = $infos['path'];