-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Smart cropping for existing images #252
Conversation
@dinhtungdu I cannot check the smart cropping as I needs to be on a remote server. Please advise on how you would like me to proceed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is working great on my live server. I have a concern about wording only, otherwise this is ready to be merged.
// Screen returns null on the Media library page. | ||
if ( ! $screen ) { | ||
$alt_tags_text = empty( get_post_meta( $post->ID, '_wp_attachment_image_alt', true ) ) ? __( 'Generate', 'classifai' ) : __( 'Rescan', 'classifai' ); | ||
$image_tags_text = empty( wp_get_object_terms( $post->ID, 'classifai-image-tags' ) ) ? __( 'Generate', 'classifai' ) : __( 'Rescan', 'classifai' ); | ||
$smart_crop_text = empty( get_transient( 'classifai_azure_computer_vision_smart_cropping_latest_response' ) ) ? __( 'Generate', 'classifai' ) : __( 'Rescan', 'classifai' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$smart_crop_text = empty( get_transient( 'classifai_azure_computer_vision_smart_cropping_latest_response' ) ) ? __( 'Generate', 'classifai' ) : __( 'Rescan', 'classifai' ); | |
$smart_crop_text = empty( get_transient( 'classifai_azure_computer_vision_smart_cropping_latest_response' ) ) ? __( 'Generate', 'classifai' ) : __( 'Regenerate', 'classifai' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dinhtungdu I've updated the above wording
@dinhtungdu I've just noticed I've added this to the media modal: But not to the media edit page: I'll get this done also |
@dinhtungdu I've also added the functionality to the media edit page |
$settings = get_option( 'classifai_computer_vision' ); | ||
$captions = get_post_meta( $post->ID, '_wp_attachment_image_alt', true ) ? __( 'Rescan Alt Text', 'classifai' ) : __( 'Scan Alt Text', 'classifai' ); | ||
$tags = ! empty( wp_get_object_terms( $post->ID, 'classifai-image-tags' ) ) ? __( 'Rescan Tags', 'classifai' ) : __( 'Generate Tags', 'classifai' ); | ||
$smart_crop = get_transient( 'classifai_azure_computer_vision_smart_cropping_latest_response' ) ? __( 'Regenerate Smart Crop', 'classifai' ) : __( 'Generate Smart Crop', 'classifai' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another wording comment for this, "Smart Crop" is not straightforward for end-users. May be "Generate Smart Thumbnail" or just "Generate Thumbnail"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dinhtungdu changed as requested to "Generate Smart Thumbnail"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Description of the Change
This PR adds the ability to Smart Crop existing images in WP Admin. It relates to #213.
Scope/Approach
Benefits
Allows Smart cropping of pre-existing images from the media attachments screen.
Verification Process
NOTE: I could not check the last step as this needs to be done on a remote server. I was able to track the functionality through the code.
Checklist:
Applicable Issues
#213