wp-media / imagify-plugin

Speed up your website with lighter images without losing quality.
https://imagify.io
69 stars 24 forks source link

AVIF images arenot automatically generated for existing images after enabling the option #796

Closed Mai-Saad closed 3 months ago

Mai-Saad commented 4 months ago

Before submitting an issue please check that you’ve completed the following steps:

Describe the bug When enabling AVIF, it isnot automatically generate AVIF for existing images in the media library

To Reproduce Steps to reproduce the behavior:

  1. Fresh activation of imagify
  2. Upload a couple of images
  3. Enable create AVIF option and save
  4. Check FTP for images in 2 => AVIF not generated

Expected behavior AVIF version is generated and quota is affected

Additional context Add any other context about the problem here.

Acceptance Criteria (for WP Media team use only) Clear instructions for developers, to be added before the grooming

Miraeld commented 4 months ago

Umm, from my tests, here are some complementary informations:

meta_key meta_value
_imagify_status already_optimized

Because of this, when we enable AVIF and save, it gets to this line where we get the unoptimized media_ids. However, as the status says already_optimized it won't return these images IDs.

So the problems lies in the fact that Auto-Optimize images on upload set the status at already_optimized so images aren't getting picked up by the bulk optimization when we save with AVIF enabled.

piotrbak commented 4 months ago

@Miraeld Could you check how this button works in the current version? The behaviour should be very similar

Miraeld commented 4 months ago

I've compared a bit with develop branch. From what I am seeing,

@piotrbak I've tried to check the button, but it is also not working on avif branch, and I was trying to debug it on develop to see how it works, and why we could get an error, but once i clicked it one time it disappeared forever, even when I upload new images which aren't optimized. So not sure yet, I'm trying to figure out the differences between develop and avif on the upload part.

Mai-Saad commented 3 months ago

If we have single large image in media library then enabled AVIF, the AVIF won't be generated in background (tested local using attached image) @Miraeld can you please check if it's working for this image? (note: bulk notice wasnot displayed in this case) mountain

Miraeld commented 3 months ago

@Mai-Saad , I've created this PR https://github.com/wp-media/imagify-plugin/pull/811 to take care of this last feedback.