Get image dimensions without EXIF extension
Use `getimagesize` when `exif_imagetype` doesn't exist.
This commit is contained in:
parent
c6fc1d4e89
commit
a8da5b1b72
|
|
@ -132,7 +132,12 @@ class Image
|
|||
throw new InvalidImageException;
|
||||
}
|
||||
$imgData = getimagesize($source);
|
||||
if (function_exists('exif_imagetype')) {
|
||||
$this->imageType = exif_imagetype($source);
|
||||
} else {
|
||||
$tmp = getimagesize($source);
|
||||
$this->imageType = $tmp[2];
|
||||
}
|
||||
if (!in_array($this->imageType, $supportedTypes)) {
|
||||
throw new UnsupportedImageTypeException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,7 +270,12 @@ class Word2007 implements IWriter
|
|||
if (stripos(strrev($src), strrev('.php')) === 0) {
|
||||
$extension = 'php';
|
||||
} else {
|
||||
if (function_exists('exif_imagetype')) {
|
||||
$imageType = exif_imagetype($src);
|
||||
} else {
|
||||
$tmp = getimagesize($src);
|
||||
$imageType = $tmp[2];
|
||||
}
|
||||
if ($imageType === \IMAGETYPE_JPEG) {
|
||||
$extension = 'jpg';
|
||||
} elseif ($imageType === \IMAGETYPE_GIF) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue