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

Add server-side photo rotation #304

Closed
Tracked by #218 ...
teolemon opened this issue Nov 29, 2021 · 3 comments · Fixed by #309
Closed
Tracked by #218 ...

Add server-side photo rotation #304

teolemon opened this issue Nov 29, 2021 · 3 comments · Fixed by #309

Comments

@teolemon
Copy link
Member

teolemon commented Nov 29, 2021

What

Add server-side photo rotation
https://openfoodfacts.github.io/api-documentation/#jump-4WRITERequests-Rotateaphoto

Part of

@teolemon teolemon changed the title Server-side photo rotation https://openfoodfacts.github.io/api-documentation/#jump-4WRITERequests-Rotateaphoto Add server-side photo rotation Nov 29, 2021
@monsieurtanuki
Copy link
Contributor

@teolemon Same "what is imgid?" question as in #305.

@teolemon
Copy link
Member Author

teolemon commented Dec 4, 2021

imgid you can find in the request, it's a unique id assigned to uploaded images, regardless of whether they are selected or not. You apply a rotation to a raw image id, and you place it in id like front_fr (which is a selection)
https://world.openfoodfacts.org/api/v0/product/3017620422003.json?fields=images

https://world.openfoodfacts.org/product/3760284870115/tiramisu-patissier
https://world.openfoodfacts.org/images/products/376/028/487/0115/1.jpg (1 is imgid)
https://world.openfoodfacts.org/images/products/376/028/487/0115/front_fr.8.full.jpg (front_fr is id, the 8 gets assigned automatically)

@monsieurtanuki monsieurtanuki self-assigned this Dec 4, 2021
@monsieurtanuki
Copy link
Contributor

Thank you @teolemon: the first step is to retrieve imgid from the product json into ProductImage - which was not the case so far.
I'm working on it...

monsieurtanuki added a commit to monsieurtanuki/openfoodfacts-dart that referenced this issue 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
@monsieurtanuki monsieurtanuki linked a pull request Dec 5, 2021 that will close this issue
monsieurtanuki added a commit to monsieurtanuki/openfoodfacts-dart that referenced this issue Dec 9, 2021
Impacted file:
* `ProductImage.dart`
monsieurtanuki added a commit that referenced this issue Dec 9, 2021
…309)

Deleted file:
* `corn_da.jpg`

Impacted files:
* `api_addProductImage_test.dart`: added tests for `OpenFoodAPIClient.setProductImageAngle` and `OpenFoodAPIClient.setProductImageCrop`; removed a duplicate test; minor refactoring
* `ImageHelper.dart`: added methods `getProductImageRootUrl` and `getProductImageFilename`; minor refactoring
* `JsonHelper.dart`: decoded new fields `imgid`, `angle` and crop fields of `ProductImage` for product `'images`''; minor refactoring
* `openfoodfacts.dart`: new methods `setProductImageAngle` and `setProductImageCrop`; minor refactoring
* `ProductHelper.dart`: minor refactoring
* `ProductImage.dart`: added `enum ImageAngle`; added `imgid`, `angle`, crop fields `coordinatesImageSize`, `x1`, `y1`, `x2` and `y2` to `ProductImage`
* `UriHelper.dart`: unrelated refactoring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants