Description
The main objective of this filter is to allow third party plugins or developers to replace the current mechanism provided by this plugin in order to introduce his own logic or mechanism to create the additional mime types.
This is a sub-issue of #160 and related to #311.
Filter
webp_uploads_pre_generate_additional_image_source
Paramaters
image
- By default anull
value, or eitherWP_Error
or an array with the details of the created image, in the same way thesave()
method is used.attachment_id
: TheID
of the attachment being processedimage_size
: The name of the image size we are looking for. When creating the additional mime type for the full image this value would befull
in the same way it occurs in WordPress core.image_details
: An array containing the properties of image size.mime_type
: The targeted mime type of the file we are looking for.
Integration
This filter should be located when a new image is created in order to avoid using the performance plugin mechanism.
Suggested location for creation of images, as the first section of the function, if the filter return an array with the file and path property return that value.
Note: This filter should cover only the first time an image is created rather than including the subsequent edited versions to an image, a new filter would be created for subsequent edits to an image. For more details see: #307 (comment)
Suggested location for subsequent updates.
When an image is updated from within the image editor, this location in order to be fired for every single image size.