Make WordPress Core

Opened 2 years ago

Closed 15 months ago

#44316 closed enhancement (worksforme)

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

Reported by: danielbachhuber Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:


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 (6)

#1 @danielbachhuber
2 years 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.

#2 @joemcgill
15 months ago

@danielbachhuber were you ever able to resolve this? For the record, I'm not against adding additional info to image_resize_dimensions() if it would be useful.

#4 @joemcgill
15 months ago

Great! Ok to close this?

#5 @danielbachhuber
15 months ago

  • Keywords needs-patch dev-feedback removed
  • Milestone Future Release deleted

Yep, fine by me.

#6 @joemcgill
15 months ago

  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.