Skip to content

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

@felixarntz

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.

Metadata

Metadata

Labels

[Plugin] Modern Image FormatsIssues for the Modern Image Formats plugin (formerly WebP Uploads)[Type] EnhancementA suggestion for improvement of an existing feature

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions