Skip to content
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

feat: add crop command #236

Merged
merged 7 commits into from
Oct 28, 2020
Merged

feat: add crop command #236

merged 7 commits into from
Oct 28, 2020

Conversation

dinhtungdu
Copy link
Contributor

Description of the Change

This PR add new crop command to "smart crop" uploaded images. This command output detailed error about the whole process which help trouble shooting easier and more straight forward.

Some example of errors outputed:

Fetching images ...
Fetching images ... DONE (1)
Cropping 1 images ...  100% [==================================================] 0:02 / 0:02
1842:150x150: The value '1' is not valid. (classifai_smart_cropping_api_validation_errors).
Error: Cropped 0 images, 1 errors.
Fetching images ...
Fetching images ... DONE (1)
Cropping 1 images ...  100% [==================================================] 0:01 / 0:02
1842:150x150: Image URL is not accessible. (InvalidImageUrl).
Error: Cropped 0 images, 1 errors.
$ wp classifai crop
Error: Smart Cropping is disabled. Enable it in Image settings to use this command.

Verification Process

Please test this PR on a live server without CND plugin enabled.

  1. Disable Smart Cropping.
  2. Upload an image.
  3. See the thumbnail is not "smart cropped".
  4. Run wp classifai crop.
  5. See error "Smart Cropping is disabled.".
  6. Enable Smart Cropping.
  7. Run wp classifai crop again
  8. Due to the API error which is addressing in Fix: Smart cropping results not as expected #229, you will get api validation error. Apply the fix on that PR, you will see the thumbnail get cropped correctly.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Fixes #176

Changelog Entry

@dinhtungdu dinhtungdu added this to the 1.6.0 milestone Oct 19, 2020
@dinhtungdu dinhtungdu self-assigned this Oct 19, 2020
@jeffpaul jeffpaul requested a review from dkotter October 19, 2020 17:46
@jeffpaul jeffpaul mentioned this pull request Oct 21, 2020
17 tasks
@jeffpaul jeffpaul requested a review from helen October 27, 2020 18:41
dkotter
dkotter previously approved these changes Oct 28, 2020
@jeffpaul jeffpaul merged commit d2b9cde into develop Oct 28, 2020
@jeffpaul jeffpaul deleted the fix/176 branch October 28, 2020 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI Script to Smart-Crop existing images
3 participants