Pijushgupta / avif-express

Wordpress plugin to convert jpg,png and webp to avif and render them
GNU General Public License v2.0
3 stars 2 forks source link

webP fallback #7

Open Troglos opened 1 month ago

Troglos commented 1 month ago

This is not a criticism, I am trying to help improve this great plugin ;) Testing the plugin on 2 different sites using Firefox with image.avif.enabled = false

Site 1 with no cache: it tries to load https://website.it/wp-content/uploads/foto-idee.webp that doesn't exist, because I see on the server that the image formats are just the original jpg (or png) and avif. No webp found.

In my opinion it would be useful for the browser that don't support avif having the original jpg as a fallback, instead of adding webP and increasing the size of the upload folder.

Site 2 with LiteSpeed cache: when using LiteSpeed Cache the browser will always try to serve the avif version. It would be useful to add a cookie like "avif_support_false" for the browsers that don't support avif, so that the cache could be disabled in the LiteSpeed settings if this cookie exists.

Let me know if you need more details.

Pijushgupta commented 1 month ago
  1. That feature was requested by an user, to have fallback as web. I can add an extra drop-down option in the plugin setting page to select fallback image types

2.Good idea. Its it possible do the same with Apache2 or NginX?

Adding both to upcoming features

Troglos commented 1 month ago

1) It would be great if you can add this option. The problem is that no webp are generated in my test. Plus having original, webp and avif for each size would be really a lot for sites with many many images. In my case just avif + original as fallback it's enough.

2) With a cookie like "avif_support_false" it should be possible with any good caching solution I think. You just need to tell the caching plugin not to cache a site if that cookie is present.

Pijushgupta commented 1 month ago
  1. Option to set fallback image type

    image
  2. browser-avif-support cookie added. Possible value - true or false based on browsers avif support.

Troglos commented 1 month ago

I am testing it, thank you!

Two things:

1) A 'supports_avif_false' cookie should be set if the browser doesn't support avif. Otherwise it should be 'supports_avif_true'. This way we can disable the cache (or create a different one) if a ' supports_avif_false' is set. As far as I know, in Litespeed there is no way to disable cache if a cookie is false. I can just set the name.

2) If I click on the Get API key button nothing happens.

[image: Lino Sabato] Lino Sabato Freelance Web Developer

+39 329 627 7257 info@@kobalt.it @.***> kobalt.it [image: Rating stars] 48 recensioni https://g.page/r/CWDdS0mvMkcQEBM/review

Il giorno sab 1 giu 2024 alle ore 17:12 Pijush Gupta < @.***> ha scritto:

  1. Option to set fallback image type

image.png (view on web) https://github.com/Pijushgupta/avif-express/assets/1472227/0ef44714-c426-43c9-9e0f-2e3766252eca

  1. browser-avif-support cookie added. Possible value - true or false based on browsers avif support.

— Reply to this email directly, view it on GitHub https://github.com/Pijushgupta/avif-express/issues/7#issuecomment-2143481954, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAPOP7OOUET3RTKIG3KNO3ZFHQFZAVCNFSM6AAAAABISMUHDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTGQ4DCOJVGQ . You are receiving this because you authored the thread.Message ID: @.***>

Pijushgupta commented 1 month ago
  1. Updated : new cookie name browser_avif_support_false = true for unsupported browser , browser_avif_support_true = true for supported browser.
  2. I'm working on the cloud part, that is why. I don't want users to register for the cloud service for now. Link will be active on RC candidate.
Troglos commented 1 week ago

I will test the new version soon, Meanwhile I've noticed a Fatal error error in the documentation page.

[image: Lino Sabato] Lino Sabato Freelance Web Developer

+39 329 627 7257 info@@kobalt.it @.***> kobalt.it [image: Rating stars] 48 recensioni https://g.page/r/CWDdS0mvMkcQEBM/review

Il giorno sab 1 giu 2024 alle ore 19:08 Pijush Gupta < @.***> ha scritto:

  1. gonna update the code ASAP.
  2. I'm working on the cloud part, that is why. I don't want users to register for the cloud service for now. Link will be active on RC candidate.

— Reply to this email directly, view it on GitHub https://github.com/Pijushgupta/avif-express/issues/7#issuecomment-2143516832, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAPOPYDCEY43LFWLMFMBHTZFH52HAVCNFSM6AAAAABISMUHDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTGUYTMOBTGI . You are receiving this because you authored the thread.Message ID: @.***>

Pijushgupta commented 1 week ago

Thanks @Troglos for the update about the doc site. I'm working on it and it should be done in about 5 minutes.

Thanks for testing out the plugin. Please create an issue if you find anything that's not working.