Make WordPress Core

Opened 3 weeks ago

Last modified 3 weeks ago

#63322 new defect (bug)

Suggested cropping for media

Reported by: happyhobo's profile happyhobo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 6.8
Component: Media Keywords:
Focuses: ui Cc:

Description

After uploading an image and entering metadata, the select and crop screen suggests 900 by 200 as optimal and marks that as the default.  But for header images what actually fits in my site is 1000 wide, and any height.  So I always have to skip cropping for headers. If I were to accidentally hit the return key, I would hae to delete and upload again.

Change History (1)

#1 @khushipatel15
3 weeks ago

You can add this in your functions.php

function add_suggested_crop_button() {
    echo '<button id="suggested-crop-button">Suggested Crop</button>';
}
add_action('media_buttons', 'add_suggested_crop_button');
function handle_suggested_crop() {
    // Perform image analysis and return suggested crop data
}
add_action('wp_ajax_crop_image', 'handle_suggested_crop');
Note: See TracTickets for help on using tickets.