Skip to content

Add support for alternatiwe image formats like webp and avif#1651

Open
tito10047 wants to merge 22 commits intoliip:2.xfrom
tito10047:avif
Open

Add support for alternatiwe image formats like webp and avif#1651
tito10047 wants to merge 22 commits intoliip:2.xfrom
tito10047:avif

Conversation

@tito10047
Copy link
Contributor

@tito10047 tito10047 commented Feb 19, 2026

…update handling of modern image formats (WebP, AVIF).

Q A
Branch? 2.x
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Fixed tickets #1314
License MIT
Doc yes

Description

This PR refactors the way modern image formats (like WebP and AVIF) are handled within the bundle. Instead of having hardcoded logic for a single format, it introduces a generic Alternative Formats system.

Key changes:

  • Unified Configuration: Introduced alternative_formats configuration tree.
  • BC Compatibility: Existing webp configuration is automatically normalized into the new structure using a beforeNormalization step in Configuration.php.
  • Format Negotiation: Added a FormatNegotiator service to dynamically select the best image format based on the browser's Accept header (supporting AVIF, WebP, etc.).
  • Abstrakcia: Refactored FilterPathContainer to support any alternative format, while marking createWebp() as deprecated.
  • Extensibility: New formats like AVIF can now be enabled simply by adding them to the configuration without changing the bundle's core logic.

This approach follows the discussion in issue #1314, providing a future-proof solution for modern image delivery while ensuring zero breaking changes for existing installations.

Proff of concept here: just6words.com

@coveralls
Copy link

coveralls commented Feb 19, 2026

Coverage Status

coverage: 81.099% (+1.0%) from 80.126%
when pulling 5f62a74 on tito10047:avif
into 69d2df3 on liip:2.x.

@tito10047
Copy link
Contributor Author

Hi @dbu . can you help me with cs fixer? I run cs fixer as you mentioned me last time, but nothing is fixed in me setup
docker run --rm -v /home/jozefm/phpProjects/contrib/LiipImagineBundle:/code ghcr.io/php-cs-fixer/php-cs-fixer:3.66-php8.0 fix

Thx

@tito10047 tito10047 changed the title Deprecate webp configuration in favor of alternative_formats and … Add support for alternatiwe image formats like webp and avif Feb 19, 2026
…agic driver can convert to avif, imagick convert to avif before postProcessor. so I add this option use_default_driver. only if this option is set to true (defaut) imagick will convert to avif. otherwise will be do it avifenc binary
@tito10047 tito10047 marked this pull request as ready for review February 19, 2026 22:33
@tito10047
Copy link
Contributor Author

Hi @dbu . Will you look at this PR please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants