WordPress.org

Make WordPress Core

Opened 3 weeks ago

Last modified 3 weeks ago

#44316 new enhancement

Pass original file path to image_resize_dimensions() so it can be accessed in the filter

Reported by: danielbachhuber Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Media Keywords: needs-patch dev-feedback
Focuses: Cc:

Description

The Google Cloud Vision API has a neat crop hints feature that a plugin could incorporate to produce smarter thumbnail crops.

image_resize_dimensions() seems like a sensible place to incorporate this behavior. However, the image_resize_dimensions filter doesn't include the original file. For filter callbacks to know which crop hints to suggest, they'll need to have access to the original file.

We should pass the original file path into image_resize_dimensions() so the file can be inspected in the image_resize_dimensions filter.

Change History (1)

#1 @danielbachhuber
3 weeks ago

As it turns out, intermediate_image_sizes_advanced may be sufficient for my needs because I could include quadrant-based crop suggestions (e.g. top,left). I'll update once I've explored further.

Note: See TracTickets for help on using tickets.