Make WordPress Core

Changes between Initial Version and Version 10 of Ticket #55443


Ignore:
Timestamp:
03/28/2022 03:54:44 PM (3 years ago)
Author:
adamsilverstein
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #55443 – Description

    initial v10  
    4646* In src/wp-admin/includes/image.php::wp_create_image_subsizes:
    4747loop through all of the mime types returned from the `​​wp_upload_image_mime_transforms` filter, generating sub-sized images for every mime format supported by the system.  Default when a type isn’t mapped in the array  is outputting in the mime type of the uploaded image.
    48 The first type is the “primary” mime type and is stored exactly like current WordPress uploads (no change)
    49 “Full” sized images are created for each mime type supported by the system with a `-{mime extension}` appended to the file name
    50 When images over `big_image_size_threshold` are uploaded, the primary image gets a `-scaled` suffix (unchanged), alternate types get a `-{mime extension}-scaled` suffix
    51 Similarly, alternate mime rotated images get a  `-{mime extension}-rotated` suffix
    52 New image meta `sources` array stores each mime type created for each full sized image and for each sub-sized image - both the file name (`file`) and size (`filesize`) are stored.
    53 In src/wp-admin/includes/image.php::_wp_make_subsizes:
    54 Using a mapping (from the input file mime type) provided by `wp_upload_image_mime_transforms`, output sub sized images in one or more output mime types
     48 * `_wp_get_primary_and_additional_mime_types` extracts the primary and additional mime types
     49 * “Full” sized images are created for each mime type supported by the system with a `-{mime extension}` appended to the file name
     50 * When images over `big_image_size_threshold` are uploaded, the primary image gets a `-scaled` suffix (unchanged), alternate types get a `-{mime extension}-scaled` suffix
     51 * Similarly, alternate mime rotated images get a  `-{mime extension}-rotated` suffix
     52 * New image meta `sources` array stores each mime type created for each full sized image and for each sub-sized image - both the file name (`file`) and size (`filesize`) are stored.
     53 * In src/wp-admin/includes/image.php::_wp_make_subsizes:
     54 * Using a mapping (from the input file mime type) provided by `wp_upload_image_mime_transforms`, output sub sized images in one or more output mime types
    5555
    5656* In src/wp-admin/includes/image.php
    57 Add a new function `wp_upload_image_mime_transforms` as well as a matching filter named `wp_upload_image_mime_transforms` . Returns an array with the list of valid mime types that a specific mime type should be converted into.
    58 In src/wp-includes/class-wp-image-editor-gd.php and src/wp-includes/class-wp-image-editor-imagick.php:
    59 Update `make_subsize` to accept a new `mime_type` parameter that gets passed to the `_save` function when set (which already has a mime_type parameter). Add the new parameter to internal function calls as well.
     57 * Add a new function `wp_upload_image_mime_transforms` as well as a matching filter named `wp_upload_image_mime_transforms` . Returns an array with the list of valid mime types that a specific mime type should be converted into.
     58 * In src/wp-includes/class-wp-image-editor-gd.php and src/wp-includes/class-wp-image-editor-imagick.php:
     59 * Update `make_subsize` to accept a new `mime_type` parameter that gets passed to the `_save` function when set (which already has a mime_type parameter). Add the new parameter to internal function calls as well.
    6060
    6161* In src/wp-includes/media.php: Adds  new function `wp_image_use_alternate_mime_types` that is called for every image in `wp_filter_content_tags`. This function:
    62 Adds a new filter `wp_content_image_mimes` that returns the mime type(s) to try to use for output, in the order they should be tried. The default order to try is array( 'image/webp', 'image/jpeg' ), meaning if a WebP version of the image exists, WordPress will use that image for the image tag output
    63 Replaces all image components (including urls in the `src` and `srcset` attributes) when the same image is available in the preferred mime type
    64 Returning an empty array will skip any image mime type substitution ( ie. `add_filter( ‘wp_content_image_mimes’, ‘__return_empty_array’ );`
     62 * Adds a new filter `wp_content_image_mimes` that returns the mime type(s) to try to use for output, in the order they should be tried. The default order to try is array( 'image/webp', 'image/jpeg' ), meaning if a WebP version of the image exists, WordPress will use that image for the image tag output
     63 * Replaces all image components (including urls in the `src` and `srcset` attributes) when the same image is available in the preferred mime type
     64 * Returning an empty array will skip any image mime type substitution ( ie. `add_filter( ‘wp_content_image_mimes’, ‘__return_empty_array’ );`
    6565
    6666* In src/wp-includes/post.php::wp_delete_attachment_files:
    67 Delete additional mime type images referenced in the image meta root ‘sources’ array as well as each sizes->sources array when present. This ensures that additional mime images are cleaned up if the original image is deleted.
     67 * Delete additional mime type images referenced in the image meta root ‘sources’ array as well as each sizes->sources array when present. This ensures that additional mime images are cleaned up if the original image is deleted.
    6868
    69 * In src/js/_enqueues/vendor/plupload/wp-plupload.js and src/js/_enqueues/vendor/plupload/handlers.js retry count is raised from 4 to 8. Should this be filterable? Note: needs to be changed in Gutenberg as well, see https://github.com/WordPress/gutenberg/blob/23f11a18726bf69717595451ab3250cb67b426f6/packages/api-fetch/src/middlewares/media-upload.js#L38
     69* In src/js/_enqueues/vendor/plupload/wp-plupload.js and src/js/_enqueues/vendor/plupload/handlers.js retry count is raised from 4 to 8. (Should this be filterable)? This change is to accommodate the larger potential number of images that need to be created. Note: needs to be changed in Gutenberg as well, see https://github.com/WordPress/gutenberg/blob/23f11a18726bf69717595451ab3250cb67b426f6/packages/api-fetch/src/middlewares/media-upload.js#L38
    7070
    7171=== PHPUnit test changes