Skip to content

Introduce filter to use a custom mechanism to create additional mime images #307

Closed
@mitogh

Description

@mitogh

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 a null value, or either WP_Error or an array with the details of the created image, in the same way the save() method is used.
  • attachment_id: The ID of the attachment being processed
  • image_size: The name of the image size we are looking for. When creating the additional mime type for the full image this value would be full 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.

Metadata

Metadata

Assignees

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