related to #1657 code re-write

This commit is contained in:
Matthieu Leproux
2022-05-02 10:43:38 +02:00
parent 3b54f36b14
commit 3575fb56fc
+15 -3
View File
@@ -183,7 +183,7 @@ function get_sync_metadata($infos)
$file = original_to_representative($file, $infos['representative_ext']);
}
if ('image/svg+xml' === mime_content_type($file) || 'image/svg' === mime_content_type($file))
if (in_array(mime_content_type($file), array('image/svg+xml', 'image/svg')))
{
$is_svg = true;
@@ -195,8 +195,20 @@ function get_sync_metadata($infos)
$height = (string) $xmlattributes->height;
$vb = (string) $xmlattributes->viewBox;
$infos['width'] = isset($width) ? $width : explode(" ", $vb)[2];
$infos['height'] = isset($height) ? $height : explode(" ", $vb)[3];
$infos['is_svg'] = $is_svg;
if (isset($width)) {
$infos['width'] = $width;
} elseif (isset($vb)) {
$infos['width'] = explode(" ", $vb)[2];
}
if (isset($height)) {
$infos['height'] = $height;
} elseif (isset($vb)) {
$infos['height'] = explode(" ", $vb)[3];
}
}
if ($image_size = @getimagesize($file))