Closed Mai-Saad closed 8 months ago
To reproduce the issue, follow the step in the issue.
The issue is that, while saving the settings with AVIF disabled from an enabled state, we are bailing out of this condition https://github.com/wp-media/imagify-plugin/blob/5684433e2a7d126b312de47ed05d21022483374c/classes/Bulk/Bulk.php#L612-L615
As we bail-out, we don't set this transient https://github.com/wp-media/imagify-plugin/blob/5684433e2a7d126b312de47ed05d21022483374c/classes/Bulk/Bulk.php#L298 which leads to a negative number in the count => This is a reason we see a -2/0
if we have two images.
To solve the issue, we could delete https://github.com/wp-media/imagify-plugin/blob/5684433e2a7d126b312de47ed05d21022483374c/classes/Bulk/Bulk.php#L612-L615 so either avif or webp would be generated depending on what we enable and save. As it would run through https://github.com/wp-media/imagify-plugin/blob/5684433e2a7d126b312de47ed05d21022483374c/classes/Bulk/Bulk.php#L237 we would set the transient and the count would be good.
XS
No
I think this is missing expectations:
the 1st activation of imagify while having images without webP, won't generate webP by default for those images. (we shall test this case as well with the fix here or may be add new GH)
On first activation there is nothing to do I believe? The bulk optimization is there for it.
@piotrbak can you review the above points?
@Tabrisrp thanks for additional cases.
When disabling convert to AVIF, should the currently process be stopped?
The process of bulk optimization that was started before should not stop, it should move forward
Should we convert missing to WebP when disabling convert to AVIF?
I'm not sure if I fully get the use case here. In general, we should generate webp for all images when disabling the AVIF generation.
However, I can imagine that you could've meant the situation when the bulk process was running and the AVIF was disabled in the middle. Then we could just finish generating webp for images that were still not processed. Then we'd have an UI button to generate missing ones, right?
We can't generate WebP (or AVIF) images for images that have not been optimized yet, it either happens:
So on first install, you have to either optimize images individually, or through the bulk optimization, to generate the next-gen images too.
With this grooming, it would generates WebP when you disabled AVIF. So it covers In general, we should generate webp for all images when disabling the AVIF generation.
It's expected behaviour then. What do you think @Tabrisrp ?
It covers this case yes. It won't generate anything on first install, but for me it's not possible to do it.
That sounds good to me then 🆗
It covers this case yes. It won't generate anything on first install, but for me it's not possible to do it.
Here is the case (however , we can agree that it's edge case) 1- activate 2.2+ 2- enable avif 3- upload image => image is optimized and avif created 4- deactivate/delete imagify 5- install and activate imagify => webp for that image isnot automatically generated , however there is generate link displayed so I think it's ok to keep it like that
That's fine @Mai-Saad
Before submitting an issue please check that you’ve completed the following steps:
Describe the bug When we disable avif, generate missing next-gen is automatically loading in settings page while nothing no webP created (and it can be -ve )
To Reproduce Steps to reproduce the behavior:
Expected behavior Either generate next-gen not automatically triggered in this case or webp is created. Please refer to @wp-media/productimagify to confirm expected
Screenshots screen-capture (87).webm
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