public function isVectorGraphic($imagePath = null)
{
if (!$imagePath) {
$imagePath = $this->imagePath;
}
// we need to do this check first, because ImageMagick using the inkscape delegate returns "PNG" when calling
// getimageformat() onto SVG graphics, this is a workaround to avoid problems
if (preg_match("@\\.(svgz?|eps|pdf|ps|ai|indd)\$@", $imagePath)) {
return true;
}
try {
if ($this->resource) {
$type = $this->resource->getimageformat();
$vectorTypes = ["EPT", "EPDF", "EPI", "EPS", "EPS2", "EPS3", "EPSF", "EPSI", "EPT", "PDF", "PFA", "PFB", "PFM", "PS", "PS2", "PS3", "SVG", "SVGZ", "MVG"];
if (in_array(strtoupper($type), $vectorTypes)) {
return true;
}
}
} catch (\Exception $e) {
Logger::err($e);
}
return false;
}