eZ Platform Discussions

Resize a `.ico` file


#1

Salut.

I have an error when resizing an image in .ico format

{% set imageAlias = smile_image_alias( site_settings, 'site_favicon', 'small' ) %}

I go through a home helper because I don’t know how to use ez_image_alias()

    /**
     * Un helper plus facile à utiliser que le ez_image_alias()
     *
     * https://doc.ezplatform.com/en/2.2/guide/twig_functions_reference/#ez_image_alias
     *
     * @param Content $content
     * @param $fieldIdentifier
     * @param $variationName
     * @return \eZ\Publish\SPI\Variation\Values\Variation|null
     */
    public function smile_image_alias(Content $content, $fieldIdentifier, $variationName)
    {
        /** @var ImageExtension $imageExtention */
        $imageExtention = $this->container->get('ezpublish.twig.extension.image');
        $field = $content->getField($fieldIdentifier);
        return $imageExtention->getImageVariation($field, $content->versionInfo, $variationName);
    }

An exception has been thrown during the rendering of a template (“Could not load image from string”).

With the original alias it works.