fixes #1657 SVG support (both gallery and admin sides)

This commit is contained in:
Matthieu Leproux
2022-04-27 15:12:40 +02:00
committed by plegall
parent 8d1e97c8b7
commit 77b156df18
12 changed files with 66 additions and 12 deletions
+2
View File
@@ -104,6 +104,8 @@ foreach ($pictures as $row)
'URL' => $url,
'DESCRIPTION' => $desc,
'src_image' => new SrcImage($row),
'path_ext' => strtolower(get_extension($row['path'])),
'file_ext' => strtolower(get_extension($row['file'])),
) );
if ($conf['index_new_icon'])
+1 -1
View File
@@ -45,7 +45,7 @@ $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?
+11 -2
View File
@@ -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'];
@@ -57,10 +59,17 @@ final class SrcImage
$this->flags |= self::IS_MIMETYPE;
if ( ($size=@getimagesize(PHPWG_ROOT_PATH.$this->rel_path)) === false)
{
$this->rel_path = 'themes/default/icon/mimetypes/unknown.png';
if ('svg' == $ext)
{
$this->rel_path = $infos['path'];
}
else
{
$this->rel_path = 'themes/default/icon/mimetypes/unknown.png';
}
$size = getimagesize(PHPWG_ROOT_PATH.$this->rel_path);
}
$this->size = array($size[0],$size[1]);
$this->size = @array($size[0],$size[1]);
}
if (!$this->size)