diff --git a/src/PhpWord/Section/Image.php b/src/PhpWord/Section/Image.php index 89b78ce7..9f5a7838 100755 --- a/src/PhpWord/Section/Image.php +++ b/src/PhpWord/Section/Image.php @@ -116,7 +116,12 @@ class Image throw new InvalidImageException; } $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)) { throw new UnsupportedImageTypeException; } diff --git a/src/PhpWord/Writer/Word2007.php b/src/PhpWord/Writer/Word2007.php index 83bc7d21..1652ceab 100755 --- a/src/PhpWord/Writer/Word2007.php +++ b/src/PhpWord/Writer/Word2007.php @@ -254,7 +254,12 @@ class Word2007 implements IWriter if (stripos(strrev($src), strrev('.php')) === 0) { $extension = 'php'; } 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) { $extension = 'jpg'; } elseif ($imageType === \IMAGETYPE_GIF) {