ImageController::getContentType PHP Method

getContentType() private method

Get content type for given file
private getContentType ( string $path ) : string
$path string
return string
    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';
    }