public static function thumb($path, array $params, Template $template)
    {
        if (empty($path)) {
            if (empty($params['dummy'])) {
                return '';
            }
            $path = $params['dummy'];
        }
        $const = Helper::getValue($params['const'], 1, true);
        /** @var ImageProvider $imageProvider */
        $imageProvider = Instance::ensure(isset($params['imageProvider']) ? $params['imageProvider'] : 'imageProvider');
        $src = $imageProvider->get($path, Helper::getValue($params['w']), Helper::getValue($params['h']));
        if (!($const & ThumbInterface::WITHOUT_WIDTH_HEIGHT)) {
            $params['width'] = $imageProvider->width;
            $params['height'] = $imageProvider->height;
        }
        unset($params['h'], $params['w'], $params['type'], $params['const']);
        if (!empty($params['alt'])) {
            $params['alt'] = $template->replace($params['alt']);
        }
        return $const & ThumbInterface::OUTPUT_IMG ? Html::img($src, $params) : $src;
    }