mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-05 17:32:25 +02:00
fixes #1657 SVG support (both gallery and admin sides)
This commit is contained in:
committed by
plegall
parent
8d1e97c8b7
commit
77b156df18
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user