Giter Site home page Giter Site logo

Comments (7)

virtualize avatar virtualize commented on June 12, 2024 1

For generated webp images to have the .webp extension use the FormatExtensionResolver like this:

services.yaml

    # https://symfony.com/bundles/LiipImagineBundle/2.x/cache-resolver/format_extension.html
    Liip\ImagineBundle\Imagine\Cache\Resolver\FormatExtensionResolver:
        arguments:
            - '@liip_imagine.cache.resolver.default'
            - '@liip_imagine.filter.configuration'
        tags: [{ name: "liip_imagine.cache.resolver", resolver: "format_extension" }]

lip_imagine.yaml

liip_imagine:
    cache: format_extension
    #...

from liipimaginebundle.

AnthonyDUSART avatar AnthonyDUSART commented on June 12, 2024

I'm currently having the same problem

from liipimaginebundle.

stuba avatar stuba commented on June 12, 2024

Same here with bundle version 2.11.0

from liipimaginebundle.

quentint avatar quentint commented on June 12, 2024

I found how to fix that.

I'm not entirely sure why, but if you want your files to end up with the .webp extension, you have to explicitly configure your bundle with:

liip_imagine:
    webp:
        generate: true

It appears in the docs here: https://symfony.com/bundles/LiipImagineBundle/current/basic-usage.html#use-webp-if-supported

I'm not sure I fully understand how format: webp and web.generate: true cooperate 😉
I hope this helps!

from liipimaginebundle.

quentint avatar quentint commented on June 12, 2024

And now I realize setting web.generate: true generates both original and webp images, and then redirects to the best option based on browser support (as stated in the docs).

So I guess what we'd need is a proper way to use WebP for all and have the correct .webp extension 🤔 (Google's PageSpeed Insights seems to care about this).

from liipimaginebundle.

stuba avatar stuba commented on June 12, 2024

Yes I'm using webp for all images and not bothered if there is less than 4% of global audience not supporting this format. I prefer keeping things nice and simple. HTML for supporting both formats seems more complex (and might be easier to break by mistake).

SO far I have not noticed any issues with images having wrong extension, but would prefer webp as it should.

from liipimaginebundle.

quentint avatar quentint commented on June 12, 2024

Awesome, thanks a bunch!

from liipimaginebundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.