Line 1,973: |
Line 1,973: |
| | | |
| === Manipulating photos for a product === | | === Manipulating photos for a product === |
− | <pre>function update_image(imagefield) {
| |
− |
| |
− | $('#crop_' + imagefield).attr("src","/cgi/product_image_rotate.pl?code=" + code + "&imgid=" + imagefield_imgid[imagefield]
| |
− | + "&angle=" + angles[imagefield] + "&normalize=" + $("#normalize_" + imagefield).prop('checked')
| |
− | + "&white_magic=" + $("#white_magic_" + imagefield).prop('checked') );
| |
− | $('div[id="cropbuttonmsg_' + imagefield +'"]').hide();
| |
− | }
| |
− | </pre>
| |
| ==== Understanding multilingual products ==== | | ==== Understanding multilingual products ==== |
| Multilingual products can have several photos based on languages present on the packaging. Just suffix the lang code to our examples to get the relevant language(s). | | Multilingual products can have several photos based on languages present on the packaging. Just suffix the lang code to our examples to get the relevant language(s). |
Line 1,991: |
Line 1,983: |
| ==== Getting the current nutrition photo ==== | | ==== Getting the current nutrition photo ==== |
| ==== Setting a new current nutrition photo ==== | | ==== Setting a new current nutrition photo ==== |
− |
| |
− | ==== URL for the image manipulation API ====
| |
− | <pre>http://world.openfoodfacts.net/cgi/product_image_rotate.pl?code=&imgid=&angle=&normalize=&white_magic=</pre>
| |
| | | |
| ==== Choosing the product by barcode ==== | | ==== Choosing the product by barcode ==== |
Line 2,002: |
Line 1,991: |
| Values: | | Values: |
| ==== Rotating a photo ==== | | ==== Rotating a photo ==== |
− | <pre>angle=</pre> | + | <pre>http://world.openfoodfacts.net/cgi/product_image_rotate.pl?code=&imgid=&angle=&normalize=&white_magic=</pre> |
− | Values: | + | |
| + | ===== Values and output ===== |
| + | Parameters: |
| + | <pre> |
| + | imgid= |
| + | code=BARCODE |
| + | angle= Angle of the rotation |
| + | normalize = whether the source image should be normalized |
| + | white_magic = whether the source image should be "white magic"'d ( background removal) |
| + | </pre> |
| + | |
| + | <pre>function update_image(imagefield) { |
| + | |
| + | $('#crop_' + imagefield).attr("src","/cgi/product_image_rotate.pl?code=" + code + "&imgid=" + imagefield_imgid[imagefield] |
| + | + "&angle=" + angles[imagefield] + "&normalize=" + $("#normalize_" + imagefield).prop('checked') |
| + | + "&white_magic=" + $("#white_magic_" + imagefield).prop('checked') ); |
| + | $('div[id="cropbuttonmsg_' + imagefield +'"]').hide(); |
| + | } |
| + | </pre> |
| ==== Removing background on a photo ("White magic") ==== | | ==== Removing background on a photo ("White magic") ==== |
| <pre>white_magic=</pre> | | <pre>white_magic=</pre> |
Line 2,070: |
Line 2,077: |
| | | |
| This will return JSON | | This will return JSON |
| + | |
| + | |
| + | ==== URL for the image manipulation API ==== |
| | | |
| === Posting a new product === | | === Posting a new product === |