diff --git a/src/PhpWord/Section/Image.php b/src/PhpWord/Section/Image.php index 931f906fe7..ad625a7b5d 100755 --- a/src/PhpWord/Section/Image.php +++ b/src/PhpWord/Section/Image.php @@ -132,7 +132,12 @@ public function __construct($source, $style = null, $isWatermark = false) 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 fcd562ab14..33ff190c1b 100755 --- a/src/PhpWord/Writer/Word2007.php +++ b/src/PhpWord/Writer/Word2007.php @@ -270,7 +270,12 @@ private function checkContentTypes($src) 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) {