/** * Get image mime type * * @param string $pFile Filename * @return string Mime Type * @throws \PHPExcel\Writer\Exception */ private function getImageMimeType($pFile = '') { if (\PHPExcel\Shared\File::fileExists($pFile)) { $image = getimagesize($pFile); return image_type_to_mime_type($image[2]); } else { throw new \PHPExcel\Writer\Exception("File {$pFile} does not exist"); } }