Merge pull request #184 from andrew-kzoo/fix-exif-imagetype
Get image dimensions without EXIF extension
This commit is contained in:
commit
de286936f2
@ -116,7 +116,12 @@ class Image
|
|||||||
throw new InvalidImageException;
|
throw new InvalidImageException;
|
||||||
}
|
}
|
||||||
$imgData = getimagesize($source);
|
$imgData = getimagesize($source);
|
||||||
$this->imageType = exif_imagetype($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)) {
|
if (!in_array($this->imageType, $supportedTypes)) {
|
||||||
throw new UnsupportedImageTypeException;
|
throw new UnsupportedImageTypeException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -254,7 +254,12 @@ class Word2007 implements IWriter
|
|||||||
if (stripos(strrev($src), strrev('.php')) === 0) {
|
if (stripos(strrev($src), strrev('.php')) === 0) {
|
||||||
$extension = 'php';
|
$extension = 'php';
|
||||||
} else {
|
} else {
|
||||||
$imageType = exif_imagetype($src);
|
if (function_exists('exif_imagetype')) {
|
||||||
|
$imageType = exif_imagetype($src);
|
||||||
|
} else {
|
||||||
|
$tmp = getimagesize($src);
|
||||||
|
$imageType = $tmp[2];
|
||||||
|
}
|
||||||
if ($imageType === \IMAGETYPE_JPEG) {
|
if ($imageType === \IMAGETYPE_JPEG) {
|
||||||
$extension = 'jpg';
|
$extension = 'jpg';
|
||||||
} elseif ($imageType === \IMAGETYPE_GIF) {
|
} elseif ($imageType === \IMAGETYPE_GIF) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user