WordPress/wp-includes/js
Adam Silverstein 71ca314193 Media: enable generating multiple mime types for image uploads; specifically WebP versions for JPEG images by default.
This changeset adds the capability for core media uploads to generate sub sized images in more than a single mime type. The output formats for each mime type can be controlled through a filter. WebP is used as an additional output format for JPEG images by default to improve front end performance.

When generating additional mime types, only images which are smaller than the respective original are retained. By default, additional mime type images are only generated for the built-in core image sizes and any custom sizes that have opted in.

Image meta is updated with a new 'sources' array containing file details for each mime type. Each image size in the 'sizes' array also gets a new 'sources' array that contains the image file details for each mime type.

This change also increases image upload retries to accommodate additional image sizes. It also adds a `$mime_type` parameter to the `wp_get_missing_image_subsizes` function and filter.

This change adds three new filters to enable full control of secondary mime image generation and output:

* A new filter `wp_image_sizes_with_additional_mime_type_support` that filters the sizes that support secondary mime type output. Developers can use this to control the output of additional mime type sub-sized images on a per size basis.
* A new filter `wp_upload_image_mime_transforms` that filters the output mime types for a given input mime type. Developers can use this to control generation of additional mime types for a given input mime type or even override the original mime type.
* A new filter `wp_content_image_mimes` which controls image mime type output selection and order for frontend content. Developers can use this to control the mime type output preference order for content images. Content images inserted from the media library will use the available image versions based on the order from this filter.

Thanks to the many contributors who helped develop, test and give feedback on this feature.

A haiku to summarize:

Upload a JPEG
Images of all sizes
Output as WebPs

Props flixos90, MatthiasReinholz, studiolxv, markhowellsmead, eatingrules, pbiron, mukesh27, joegrainger, mehulkaklotar, tweetythierry, akshitsethi, peterwilsoncc, eugenemanuilov, mitogh, shetheliving, clarkeemily, codekraft, mikeschroder, clorith, kasparsd, spacedmonkey, trevorpfromsandee, jb510, scofennellgmailcom, seedsca, cagsmith, karinclimber, dainemawer, baxbridge, grapplerulrich, sobatkras, chynnabenton, tonylocalword, barneydavey, kwillmorth, garymatthews919, olliejones, imarkinteractive, jeffpaul, feastdesignco, webbeetle, masteradhoc.

See #55443.


Built from https://develop.svn.wordpress.org/trunk@53751


git-svn-id: http://core.svn.wordpress.org/trunk@53310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 18:03:13 +00:00
..
codemirror
crop
dist External Libraries: Update the Moment library to version 2.29.4. 2022-07-19 19:43:25 +00:00
imgareaselect Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
jcrop External Libraries: Update Jcrop to version 0.9.15. 2022-03-24 20:07:05 +00:00
jquery Build/Test Tools: Update NPM `devDependencies` to their latest versions. 2022-06-27 18:53:29 +00:00
mediaelement Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
plupload Media: enable generating multiple mime types for image uploads; specifically WebP versions for JPEG images by default. 2022-07-21 18:03:13 +00:00
swfupload
thickbox Media: Add support for WebP images in the Thickbox library. 2022-05-30 14:53:11 +00:00
tinymce Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
admin-bar.js
admin-bar.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
api-request.js
api-request.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
autosave.js External Libraries: Further fix jQuery deprecations in WordPress core. 2021-03-18 19:01:03 +00:00
autosave.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
backbone.js External Libraries: Update some external libraries. 2022-04-12 17:17:22 +00:00
backbone.min.js External Libraries: Update some external libraries. 2022-04-12 17:17:22 +00:00
clipboard.js External Libraries: Update some external libraries. 2022-04-12 17:17:22 +00:00
clipboard.min.js External Libraries: Update some external libraries. 2022-04-12 17:17:22 +00:00
colorpicker.js
colorpicker.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
comment-reply.js
comment-reply.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
customize-base.js External Libraries: Further fix jQuery deprecations in WordPress core. 2021-03-18 19:01:03 +00:00
customize-base.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
customize-loader.js
customize-loader.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
customize-models.js
customize-models.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
customize-preview-nav-menus.js
customize-preview-nav-menus.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
customize-preview-widgets.js
customize-preview-widgets.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
customize-preview.js
customize-preview.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
customize-selective-refresh.js
customize-selective-refresh.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
customize-views.js
customize-views.min.js
heartbeat.js Autosave: Compare heartbeat intervals in same unit. 2022-04-20 05:55:06 +00:00
heartbeat.min.js Autosave: Compare heartbeat intervals in same unit. 2022-04-20 05:55:06 +00:00
hoverIntent.js External Libraries: Update jQuery hoverIntent to version 1.10.2. 2022-01-03 15:03:18 +00:00
hoverIntent.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
hoverintent-js.min.js
imagesloaded.min.js
json2.js
json2.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
masonry.min.js
mce-view.js
mce-view.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
media-audiovideo.js Build: Update webpack to v5.x 2022-04-11 12:04:30 +00:00
media-audiovideo.min.js Build: Update webpack to v5.x 2022-04-11 12:04:30 +00:00
media-editor.js
media-editor.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
media-grid.js Build: Update webpack to v5.x 2022-04-11 12:04:30 +00:00
media-grid.min.js Build: Update webpack to v5.x 2022-04-11 12:04:30 +00:00
media-models.js Build: Update webpack to v5.x 2022-04-11 12:04:30 +00:00
media-models.min.js Build: Update webpack to v5.x 2022-04-11 12:04:30 +00:00
media-views.js Build: Update webpack to v5.x 2022-04-11 12:04:30 +00:00
media-views.min.js Build: Update webpack to v5.x 2022-04-11 12:04:30 +00:00
quicktags.js Editor: Revert [51748] and [51649]. They intorduced a bug where `wp.editor` may be replaced with `wp.oldEditor` in certain cases. 2021-09-08 23:29:58 +00:00
quicktags.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
shortcode.js
shortcode.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
swfobject.js
tw-sack.js
tw-sack.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
twemoji.js Emoji: Update the Twemoji to version 14.0.2. 2022-04-12 05:56:23 +00:00
twemoji.min.js Emoji: Update the Twemoji to version 14.0.2. 2022-04-12 05:56:23 +00:00
underscore.js External Libraries: Update the Underscore library to version `1.13.4`. 2022-07-05 15:01:25 +00:00
underscore.min.js External Libraries: Update the Underscore library to version `1.13.4`. 2022-07-05 15:01:25 +00:00
utils.js
utils.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
wp-ajax-response.js Administration: Audible messages on AJAX error cases. 2022-07-16 01:08:10 +00:00
wp-ajax-response.min.js Administration: Audible messages on AJAX error cases. 2022-07-16 01:08:10 +00:00
wp-api.js
wp-api.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
wp-auth-check.js External Libraries: Further fix jQuery deprecations in WordPress core. 2021-03-18 19:01:03 +00:00
wp-auth-check.min.js External Libraries: Further fix jQuery deprecations in WordPress core. 2021-03-18 19:01:03 +00:00
wp-backbone.js
wp-backbone.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
wp-custom-header.js Customize: Set `playsinline` attribute for custom header videos. 2021-04-10 12:40:05 +00:00
wp-custom-header.min.js Customize: Set `playsinline` attribute for custom header videos. 2021-04-10 12:40:05 +00:00
wp-embed-template.js Embeds: Conditionally enqueue `wp-embed` only if needed and send `ready` message in case script loads after post embed windows. 2021-11-11 02:49:18 +00:00
wp-embed-template.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
wp-embed.js Embeds: Conditionally enqueue `wp-embed` only if needed and send `ready` message in case script loads after post embed windows. 2021-11-11 02:49:18 +00:00
wp-embed.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
wp-emoji-loader.js Emoji: Update the Twemoji to version 14.0.2. 2022-04-12 05:56:23 +00:00
wp-emoji-loader.min.js Emoji: Update the Twemoji to version 14.0.2. 2022-04-12 05:56:23 +00:00
wp-emoji-release.min.js Emoji: Update the Twemoji to version 14.0.2. 2022-04-12 05:56:23 +00:00
wp-emoji.js
wp-emoji.min.js
wp-list-revisions.js
wp-list-revisions.min.js
wp-lists.js Docs: Various inline documentation corrections and improvements. 2021-12-07 12:20:02 +00:00
wp-lists.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
wp-pointer.js External Libraries: Further fix jQuery deprecations in WordPress core. 2021-02-16 20:25:03 +00:00
wp-pointer.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
wp-sanitize.js
wp-sanitize.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
wp-util.js Widgets: Avoid a TypeError when adding a widget in the Customizer. 2021-06-25 14:50:58 +00:00
wp-util.min.js Widgets: Avoid a TypeError when adding a widget in the Customizer. 2021-06-25 14:50:58 +00:00
wpdialog.js
wpdialog.min.js
wplink.js External Libraries: Further fix jQuery deprecations in WordPress core. 2021-03-18 19:01:03 +00:00
wplink.min.js Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:07:18 +00:00
zxcvbn-async.js
zxcvbn-async.min.js Build/Test Tools: Update NPM dependencies. 2021-02-23 16:45:19 +00:00
zxcvbn.min.js