Skip to content

Add checkbox to Media screen to enable multi MIME type output (WebP and JPEG) #525

Closed

Description

@felixarntz

#524 changes the default behavior of the WebP Uploads module so that it only generates WebP by default, following the core decision, as that is a safer default.

However, the module still offers the alternative approach of generating both WebP and JPEG files. At a high level, this comes with the following tradeoff:

  • Pro: Better backward/cross compatibility since any use-case where WebP is not supported can still leverage an equivalent JPEG.
  • Contra: Large filesystem storage needs, since now every size requires two files, effectively almost doubling storage requirements.

While for a WordPress core implementation this decision would likely not be exposed as a user-facing control, for this plugin it makes more sense. It also would be applicable if WebP became a "canonical plugin".

Once #524 has been implemented, we can proceed with this one. It could work as follows:

  • A new WordPress setting is registered to control whether to output both WebP and JPEG (e.g. generate_webp_and_jpeg), which could be a simple boolean value.
  • If that setting is true, the default value of the webp_uploads_upload_image_mime_transforms filter should be changed so that it outputs both image/jpeg and image/webp for both image/jpeg and image/webp input format (effectively the same as it was prior to Modify WebP default behavior to follow latest decision (generate only WebP for JPEG) #524).
  • A UI control (checkbox) for the setting could be added under "Settings > Media" in the "Uploads" section.
    • Label could be Generate JPEG files in addition to WebP
    • It would be good to add a brief description below that explains the tradeoffs, e.g. Enabling JPEG in addition to WebP can improve compatibility, but will effectively double the filesystem storage use of your images.

Activity

  1. felixarntz commented on Sep 12, 2022

    @felixarntz
    MemberAuthor

    @bethanylang Would you mind reviewing the suggested wording for the UI here?

  2. mxbclang commented on Sep 14, 2022

    @mxbclang
    Contributor

    @felixarntz Language LGTM!

  3. added this to the 1.6.0 milestone on Sep 14, 2022
  4. felixarntz commented on Sep 14, 2022

    @felixarntz
    MemberAuthor

    @eugene-manuilov I see you self assigned this, but since #524 requires a lot more attention than we though, it would probably be best to focus on that.

    Maybe someone else could pick up this issue here? While it's technically blocked by #524, I'd say we could already start the PR here, since the only change here that would interfere with #524 should be the logic in webp_uploads_get_upload_image_mime_transforms() (see https://github.com/WordPress/performance/pull/527/files#diff-1f653bd37f60a6476485a6794f7003a91b3713868c7414588d5835332fe68642R17). Let's get this started, just not merge it prior to completing #524.

  5. removed their assignment
    on Sep 14, 2022
  6. eugene-manuilov commented on Sep 14, 2022

    @eugene-manuilov
    Contributor

    Yep, sounds good to me, @felixarntz. Unassigned myself.

  7. removed
    Needs DevAnything that requires development (e.g. a pull request)
    on Sep 21, 2022
  8. removed their assignment
    on Sep 21, 2022
  9. mehulkaklotar commented on Sep 21, 2022

    @mehulkaklotar
    Member

    Work done

    • WordPress setting generate_webp_and_jpeg -> boolean value
    • Changes default filter output for webp_uploads_upload_image_mime_transforms to image/jpeg and image/webp if the generate_webp_and_jpeg is true

    Remaining work(After #524 is merged)

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions