public static function addDimensionsAttributes($in)
{
- if (!strstr($in, '<svg') && file_exists($in)) {
+ if (!str_contains($in, '<svg') && file_exists($in)) {
$in = file_get_contents($in);
}
try {
if (!isset($attr['height'])) {
$xmlsvg->addAttribute('height', (float)$e[3]);
}
- return preg_replace('\<\?xml.*\?\>', '', $xmlsvg->asXML());
+ $in = $xmlsvg->asXML();
}
} catch (\Exception $e) {
-
+ Log::warning($e->getMessage());
}
+ return $in;
+ }
+
+ public static function removeXMLDeclaration($in)
+ {
+ return trim(preg_replace('/\<\?xml.*\?\>/', '', $in));
+ }
+
+ public static function removeXMLComments($in)
+ {
+ return trim(preg_replace('/\<!--.*--\>/', '', $in));
+ }
+
+ public static function disablePreserveRatio($in)
+ {
return self::_disablePreserveRatio($in);
}