Images within Studio settings - Approach and limitations
Oct 28, 2021
Content
Context
If customers want to use images in their displays, such as brands' logo or attributes (organic, nutriscore, …), there are two ways:
Add the images to the settings, best suited if you have few images and they do not change often;
Use an image server, to be used when images are prone to changes and/or when lots of images are used.
Images within the setting
How-To
By uploading the needed images to Studio on the project page (on the right, “Project images”). In case you want to change an existing image, add it to your setting and redeploy to your stores.
By using the image directly in the display or use the “NO_PREVIEW” image and call the image by its name.
function value(article, extended, label){
return "image_name.png";
}
Limitations & best practices
Image format
PNG only
Only with colors used by targeted labels (so red/black/white/yellow)
Resolution
For each label size, an optimized version has to exist for it
Must be adapted to the labels' size: a 200 pixels labels can’t receive an image greater than 200 pixels
Must be adapted to the target area as much as possible
Max image size allowed: 1024*1024
The whole setting should not exceed 50 MB
Maximum number of images per settings : 1,000
Remove from your setting the images that are not used anymore
Image from a web server
How-To
Our rendering engine is capable of retrieving images via URLs:
In Studio, add a "NO_PREVIEW” image, in "Computed value", you must return the full URL:
function value(article, extended, label){
return "http://datamatrix.kaywa.com/img.php?s=8&d="+article.id;
}
Limitations & best practices
Image format:
PNG only
Only with colors used by targeted labels (so red/black/white/yellow)
Resolution:
For each label size, an optimized version has to exist for it
Must be adapted to the labels' size: a 200 pixels labels can’t receive an image greater than 200 pixels
Must be adapted to the target area as much as possible
Max image allowed: 1024*1024
Latency from Azure hosting region (included remote download):
Max: 200ms
Average: 50ms
Max count of various images per day: 5000
The availability of your server must be: 99.99%
It is best to use HTTPS, rather than plain HTTP.
Image must be in PNG format and in direct call (no redirection or image in base64 within a body). For instance user/password within the URL cannot be used.