mirror of
https://github.com/Intervention/image.git
synced 2025-08-01 11:30:16 +02:00
replaced own getMime with finfo
This commit is contained in:
@@ -57,23 +57,8 @@ class Source extends \Intervention\Image\AbstractSource
|
||||
|
||||
// build image
|
||||
$image = $this->initFromImagick($core);
|
||||
$image->mime = $this->getMime($core);
|
||||
$image->mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $binary);
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
private function getMime(\Imagick $core)
|
||||
{
|
||||
$info = $core->identifyImage(true);
|
||||
|
||||
if (preg_match("/Mime type: (?P<mime>[-\w+]+\/[-\w+]+)/", $info['rawOutput'], $match)) {
|
||||
|
||||
return $match['mime'];
|
||||
|
||||
} else {
|
||||
throw new \Intervention\Image\Exception\RuntimeException(
|
||||
"Mime type could not be extracted from image."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user