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 |
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. |
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’ );` |