public static function isImage($name)
    {
        if (isset($_FILES[$name])) {
            $tempFile = $_FILES[$name]['tmp_name'];
            if (!empty($tempFile) && file_exists($tempFile)) {
                $image = getimagesize($tempFile);
                switch ($image['mime']) {
                    case 'image/gif':
                    case 'image/png':
                    case 'image/bmp':
                    case 'image/tiff':
                    case 'image/jpeg':
                        return true;
                }
            }
        }

        if (file_exists($name)) {
            $image = getimagesize($name);
            switch ($image['mime']) {
                case 'image/gif':
                case 'image/png':
                case 'image/bmp':
                case 'image/tiff':
                case 'image/jpeg':
                    return true;
            }
        }

        return false;
    }