Closed teolemon closed 1 year ago
I am having this problem as well.
@teolemon @FoodCoach-App Please provide barcode examples (and related packaging or ingredient photos).
I'm setting up the API and am having problems uploading an image data to UPC 0247637306390
The URL request is: https://us.openfoodfacts.org/cgi/product_jqm2.pl?code=0247637306390&user_id=MY_USER_ID&password=MY_PASSWORD&&product_image_upload.pl/imgupload_front=image_front.jpg
This is a POST request from Xano if that matters.
I'm attempting to follow this example: https://openfoodfacts.github.io/api-documentation/#jump-4WRITERequests-Addanewproduct and this example: https://openfoodfacts.github.io/openfoodfacts-server/introduction/api/
But they differ on several points.
This is NOT with the OpenFoodFacts app. I'm attempting to use existing API calls to allow FoodCoach users to add and take pictures of foods for OFF from FoodCoach.
@monsieurtanuki happens on all products without an ingredients photo Link for a scannable barcode: barcode-8056446541685
@teolemon Thank you but I cannot scan, remember? The barcode is enough. I'll upload a photo of my holidays on the French Riviera as an ingredients photo.
@teolemon To be honest this is not a picture from the French Riviera but that's not the point. The point is that I managed to upload an ingredient picture in the first try with the app: https://fr.openfoodfacts.org/produit/8056446541685/fagioli-cannellini-the-brand
I went to
Why I may not have worked for you:
- I tried from the carrousel, from the Photos section in editing, and now from the basic info as well. Same issue in all cases
I tried only from basic info. Please provide other barcodes if you want me to try with the carrousel (product page top, right?) and the edit photo / crop page
- No failed tasks, on wifi.
OK
- New pictures from my camera, so no chance it's in the DB
OK
- Are you testing on a physical device ?
No this is still not possible for me (cf. #2849)
- I tried from the carrousel, from the Photos section in editing, and now from the basic info as well. Same issue in all cases
- New pictures from my camera, so no chance it's in the DB
Getting the same result when i try.
I'm setting up the API and am having problems uploading an image data to UPC 0247637306390
@FoodCoach-App @teolemon Done from the product page top carrousel:
Could be a "waterfall pictures only" filter on the server... ;)
Or maybe the version? I'm on Android 4.1.0+847
@aquilax I don't know anything about the version numbers. I work on the latest github code.
haha, perhaps.
In your successfully OFF image upload, what is/was the request URL?
I'm attempting to use:
but it's not working.
The response status is: no code or invalid code
What code OFF looking for?
On Tue, Jan 3, 2023 at 12:13 PM monsieurtanuki @.***> wrote:
Could be a "waterfall pictures only" filter on the server... ;)
— Reply to this email directly, view it on GitHub https://github.com/openfoodfacts/smooth-app/issues/3490#issuecomment-1370021474, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4J6ZUF53WZ7RJSRWAT6BC3WQRMZ3ANCNFSM6AAAAAATMGSCKQ . You are receiving this because you were mentioned.Message ID: @.***>
The "no code or invalid code" is when I was attempting to upload images with "put".
I get "fields saved", but no update to the image when using "get".
@FoodCoach-App Please have a look at:
/// Uploads the product image.
@override
Future<void> upload() async {
final SendImage image = SendImage(
lang: getLanguage(),
barcode: barcode,
imageField: ImageField.fromOffTag(imageField)!,
imageUri: Uri.parse(imagePath),
);
// TODO(AshAman999): check returned Status
await OpenFoodAPIClient.addProductImage(getUser(), image);
}
/// Send one image to the server.
/// The image will be added to the product specified in the SendImage
/// Returns a Status object as result.
static Future<Status> addProductImage(
User user,
SendImage image, {
QueryType? queryType,
}) async {
var dataMap = <String, String>{};
var fileMap = <String, Uri>{};
dataMap.addAll(image.toData());
fileMap.putIfAbsent(image.getImageDataKey(), () => image.imageUri);
var imageUri = UriHelper.getUri(
path: '/cgi/product_image_upload.pl',
queryType: queryType,
addUserAgentParameters: false,
);
return await HttpHelper().doMultipartRequest(
imageUri,
dataMap,
files: fileMap,
user: user,
queryType: queryType,
);
}
And perhaps https://github.com/openfoodfacts/openfoodfacts-dart/blob/master/lib/src/model/send_image.dart
4.1.0 876 is latest internal, in sync with the repository
Mmmmh, note that it also happens on the nutrition fact photo
@aquilax @FoodCoach-App Can you try uploading with the latest version of the app, and copy paste what ADB mentions
@monsieurtanuki has set up extra logging
@teolemon can you help me found out how to get a dev build?
Ok, I can't upload on product addition either https://world-fr.openfoodfacts.org/produit/3263854938111/uu-yu
@aquilax it's build from source, of the internal in the README, but I'm not sure it logs everything
Hello @teolemon
I did just try to add a pic and it worked, I clicked to upload from the carousel, I am on the latest release from test flight app version 4.1.0+885-ml-ios
I'm on Android 13, on a Pixel, for what it's worth.
I'm on Android 13, on a Pixel, for what it's worth.
@teolemon So you tried on your Android 13 Pixel, you went to a Crop page, you clicked on Confirm and nothing happened:
Am I right?
What if you slightly crop the image?
Bingo, it works on recrop
Yoohoo!
I'll fix it today.
For the anecdote
What
Steps to reproduce the behavior