private function getContentType($path) { if (file_exists($path)) { $info = getimagesize($path); return $info['mime']; } foreach ($this->types as $type) { if (preg_match("/\\.{$type}\$/i", $path)) { return "image/{$type}"; } } return 'image/jpeg'; }