related to #1657 SVG default size is saved in database

This commit is contained in:
Matthieu Leproux
2022-04-27 15:12:40 +02:00
parent 8dae4cb770
commit 3b54f36b14

View File

@@ -163,6 +163,7 @@ function get_sync_metadata($infos)
$infos['filesize'] = floor($fs/1024);
$is_tiff = false;
$is_svg = false;
if (isset($infos['representative_ext']))
{
@@ -177,12 +178,27 @@ 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 ('image/svg+xml' === mime_content_type($file) || 'image/svg' === mime_content_type($file))
{
$is_svg = true;
$xml = file_get_contents($file);
$xmlget = simplexml_load_string($xml);
$xmlattributes = $xmlget->attributes();
$width = (string) $xmlattributes->width;
$height = (string) $xmlattributes->height;
$vb = (string) $xmlattributes->viewBox;
$infos['width'] = isset($width) ? $width : explode(" ", $vb)[2];
$infos['height'] = isset($height) ? $height : explode(" ", $vb)[3];
}
if ($image_size = @getimagesize($file))
{
$infos['width'] = $image_size[0];
@@ -244,7 +260,7 @@ SELECT id, path, representative_ext
{
continue;
}
// print_r($data);
$id = $data['id'];
foreach (array('keywords', 'tags') as $key)
{