public function getMimeType() { if (!file_exists($this->getPath())) { throw new \Exception('File ' . $this->getPath() . ' does not exist'); } $image = getimagesize($this->getPath()); return image_type_to_mime_type($image[2]); }