Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes 2554: Prevent having a webp bigger than the original #751

Merged
merged 17 commits into from
Nov 13, 2023

Conversation

CrochetFeve0251
Copy link
Contributor

Description

Fixes #2554

Display the message when we display a original format instead of the webp one.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality).

Is the solution different from the one proposed during the grooming?

No.

Checklists

Generic development checklist

  • My code follows the style guidelines of this project, with adapted comments and without new warnings.
  • I have added unit and integration tests that prove my fix is effective or that my feature works.
  • The CI passes locally with my changes (including unit tests, integration tests, linter).
  • Any dependent changes have been merged and published in downstream modules.
  • If applicable, I have made corresponding changes to the documentation. Provide a link to the documentation.

Test summary

  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I validated all Acceptance Criteria of the related issues. (If applicable, provide proof).
  • I validated all test plan the QA Review asked me to.

If not, detail what you could not test.

Please describe any additional tests you performed.

@CrochetFeve0251 CrochetFeve0251 requested a review from a team October 25, 2023 09:11
Copy link
Contributor

@remyperona remyperona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not understanding how the changes are preventing the WebP bigger than original?

Also, the referenced issue is not correct.

@remyperona
Copy link
Contributor

We also have this PR related #706

@Mai-Saad Mai-Saad self-requested a review November 6, 2023 09:37
@Mai-Saad
Copy link

Mai-Saad commented Nov 8, 2023

@CrochetFeve0251 Thanks for the update. Please find exploratory test notes below
1- The served image at the FE has size > the optimized size (for this image WebP isnot generated, however it's served, shouldn't we serve png in this case? even if the option to display WebP image on the website is enabled @wp-media/productimagify ) test page https://imagify.rocketlabsqa.ovh/test-webp/
Screenshot from 2023-11-08 09-23-55
Screenshot from 2023-11-08 09-22-06
2- WebP generated is always no although it was generated (@wp-media/productimagify what shall be the text for convert when the image is converted to WebP? do we really need this field? /cc @MathieuLamiot )
Screenshot from 2023-11-08 09-38-48
on trunk
Screenshot from 2023-11-08 09-51-55

@MathieuLamiot
Copy link
Contributor

@Mai-Saad, thanks for the detailed report.
About the 2nd point:

  • If the WebP is generated (because it is smaller), then WebP Generated should be set to "Yes".
  • If the WebP is not generated (because it is bigger, or for any other reasons actually), then WebP generated should be set to "No".
    I think it should be fixed as part of this issue @CrochetFeve0251

I do agree it seems a bit redundant with the message above saying WebP is not generated because it is bigger. It could be a small simplification, but let's see what @wp-media/productimagify thinks about this. We might not have all the cases in minds. In any case, that would be outside the scope of the issue..

@Mai-Saad
Copy link

Mai-Saad commented Nov 9, 2023

@CrochetFeve0251 Thanks for the update. @MathieuLamiot Thanks for the feedback.
Currently:

  • Specific image has no WebP generated while status is yes
    Screenshot from 2023-11-09 18-04-06

  • An image which isnot converted, is served with a bigger size (tested on chrome ubuntu) (note: this image wasnot compressed somehow)

Screenshot from 2023-11-09 18-06-32

Screenshot from 2023-11-09 18-05-46

@Mai-Saad
Copy link

Mai-Saad commented Nov 10, 2023

@CrochetFeve0251 Thanks for the update. Working as the following now. If agreed by @wp-media/productimagify then we can merge. /cc @MathieuLamiot

  1. Original image is non webp
  • If generated WebP is < original image => no convert msg, WebP generated status is yes and served on FE if the serve option is enabled
  • If generated WebP is > original image => convert msg Webp is less performant than original, WebP generated status is either No (if no webp file added to upload folder) or partial (if the webP file added to upload folder), image.extension is served on FE (as same as that in upload folder without extension nor dimensions and it is <= original size) if the serve webP option on/off

2- Original image is webP

  • no convert msg, WebP generated status is No, The optimized image is served (approximately as same as that in upload folder )

3- Already on trunk, origional/ optimized size is not matching that in the upload folder https://wp-media.slack.com/archives/CU0F6EGQ1/p1699598198861799

4- Already on trunk, while display image in webp isnot checked, the used size at FE is that of webp but without adding webp extension https://wp-media.slack.com/archives/CU0F6EGQ1/p1699618969452739

@DahmaniAdame
Copy link

Looks good. The only change is on the wording to make it clearer about why the origin image will be served instead:

Change:

Webp is less performant than original

To:

WebP file is larger than the original image

@Mai-Saad Mai-Saad added this pull request to the merge queue Nov 13, 2023
Merged via the queue into develop with commit 93d6964 Nov 13, 2023
6 checks passed
@Mai-Saad Mai-Saad deleted the enhancement/2554-prevent-bigger-webp branch November 13, 2023 13:50
@Mai-Saad
Copy link

Screenshot from 2023-11-13 15-58-06

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

Successfully merging this pull request may close these issues.

5 participants