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: #304 - new method setProductImageAngle #309

Merged
merged 3 commits into from Dec 9, 2021

Conversation

monsieurtanuki
Copy link
Contributor

@monsieurtanuki monsieurtanuki commented Dec 5, 2021

Deleted file:

  • corn_da.jpg

Impacted files:

  • api_addProductImage_test.dart: added a test for OpenFoodAPIClient.setProductImageAngle; removed a duplicate test
  • JsonHelper.dart: decoded new fields imgid and angle for product 'images'
  • openfoodfacts.dart: new method setProductImageAngle
  • ProductImage.dart: added enum ImageAngle; added imgid and angle to ProductImage
  • UriHelper.dart: unrelated refactoring

Deleted file:
* `corn_da.jpg`

Impacted files:
* `api_addProductImage_test.dart`: added a test for `OpenFoodAPIClient.setProductImageAngle`; removed a duplicate test
* `JsonHelper.dart`: decoded new fields `imgid` and `angle` for product `'images`''
* `openfoodfacts.dart`: new method `setProductImageAngle`
* `ProductImage.dart`: added `enum ImageAngle`; added `imgid` and `angle` to `ProductImage`
* `UriHelper.dart`: unrelated refactoring
@monsieurtanuki monsieurtanuki linked an issue Dec 5, 2021 that may be closed by this pull request
Impacted files:
* `api_addProductImage_test.dart`: added a test for `OpenFoodAPIClient.setProductImageCrop`; minor refactoring
* `ImageHelper.dart`: added methods `getProductImageRootUrl` and `getProductImageFilename`; minor refactoring
* `JsonHelper.dart`: populated crop fields of `ProductImage` for product `'images'`; minor refactoring
* `openfoodfacts.dart`: added method `setProductImageCrop`; minor refactoring
* `ProductHelper.dart`: minor refactoring
* `ProductImage.dart`: added crop fields `coordinatesImageSize`, `x1`, `y1`, `x2` and `y2` to `ProductImage`
@monsieurtanuki monsieurtanuki linked an issue Dec 7, 2021 that may be closed by this pull request
Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @monsieurtanuki, I have nothing major to put out, but please have a look at my comments


String get degreesClockwise => _DEGREES_CLOCKWISE[this]?.toString() ?? '0';

static ImageAngle? fromInt(final int? angle) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment here that it only allow 0, 90, 170 and 270

image.rev.toString() +
'.' +
image.size.toNumber() +
'.jpg';
Copy link
Member

@M123-dev M123-dev Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the server allow other types then .jpg

Impacted file:
* `ProductImage.dart`
@monsieurtanuki monsieurtanuki merged commit c69f3f6 into openfoodfacts:master Dec 9, 2021
@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev for your code review! Yes it's always .jpg files - it was so even before my refactoring, and it looked so too in the perl code I read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add server-side crop a photo Add server-side photo rotation
3 participants