I'm working on a WordPress plugin that needs to force the images uploaded by a user to be a very specific proportions and ideally have the dimensions 1024 X 350 for use on the header of a page. The WordPress header image uploader provided by wp.media (https://codex.wordpress.org/Javascript_Reference/wp.media) in the Customizer has a great set of features that work exactly the way that i am looking for:
User clicks on a button to bring up the media modal:
User chooses their image and then clicks "select and crop"
user then crops the image in the media modal to their desired dimensions BUT the media modal always maintains the image proportions relative to the desired crop.
Clicking Crop then exits the media modal and creates a copy of the image in the media library and provides the cropped version for use on the page.
The question is: can this code/flow be repurposed to work on any image using the wp_media dialogue box?