1
0
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:
Oliver Vogel
2014-05-13 17:36:09 +02:00
parent b1644ef86d
commit 2a851b4a16

View File

@@ -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."
);
}
}
}