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
+28 -2
View File
@@ -177,12 +177,38 @@ function get_sync_metadata($infos)
// for width/height (to compute the multiple size dimensions)
$is_tiff = true;
}
}
$file = original_to_representative($file, $infos['representative_ext']);
}
if (in_array(mime_content_type($file), array('image/svg+xml', 'image/svg')))
{
$xml = file_get_contents($file);
$xmlget = simplexml_load_string($xml);
$xmlattributes = $xmlget->attributes();
$width = (int) $xmlattributes->width;
$height = (int) $xmlattributes->height;
$vb = (string) $xmlattributes->viewBox;
if (isset($width) and $width != "")
{
$infos['width'] = $width;
} elseif (isset($vb))
{
$infos['width'] = explode(" ", $vb)[2];
}
if (isset($height) and $height != "")
{
$infos['height'] = $height;
} elseif (isset($vb))
{
$infos['height'] = explode(" ", $vb)[3];
}
}
if ($image_size = @getimagesize($file))
{
$infos['width'] = $image_size[0];
@@ -244,7 +270,7 @@ SELECT id, path, representative_ext
{
continue;
}
// print_r($data);
$id = $data['id'];
foreach (array('keywords', 'tags') as $key)
{