ImageTemplate Model#
Defines how offer image should be rendered.It's a common interface used for:Example#
{
"width": 600,
"height": 800,
"background_url": "https://cdn-files.placewise.com/files/uuUHXAoLdRIX3Am4SHaR1iGyv8yK6-G_a845txA7HUqYhETqgo9",
"rectangles": [],
}
Definition#
Attribute | Type | Description |
---|
width | integer | Defines width of the image in pixels, between 1 and 2000 |
height | integer | Defines height of the image in pixels, between 1 and 2000 |
background_url | string | URL of background image. |
rectangles | TemplateRectangle[] | See ImageTemplate Rectangle |
The output image is rendered from the template after offer creation/update request, asynchronously.Rendering process draws rectangles (up to 4) over an optional background image.When rendering is done, the image is stored as a regular file of the subject offer.ImageTemplate Record#
Example#
{
"id": 2,
"name": "Majadada3",
"width": 600,
"height": 800,
"background_url": "https://cdn-files.placewise.com/files/uuUHXAoLdRIX3Am4SHaR1iGyv8yK6-G_a845txA7HUqYhETqgo9",
"default": false,
"rectangles": [],
"created_at": "2020-09-04T14:55:44.385Z",
"updated_at": "2020-09-04T14:55:44.385Z"
}
Definition#
background_url
attribute#
The background image for record must be uploaded to Files API as offer_template_background
and with identifier of given
ImageTemplate
record.default
attribute#
It's possible to mark template as default for LC (doing this will un-mark previous default offer, if such exists).It's up to API client how to utilize this feature.ImageTemplate payload#
Example#
{
"name": "Majadada3",
"width": 600,
"height": 800,
"default": false,
"rectangles": []
}
Definition#
ImageTemplate Rectangle#
Example#
{
"name": "Title",
"width": 100,
"height": 200,
"padding": 5,
"offset_top": 5,
"offset_left": 15,
"text_align": "center",
"color": "#FF00FF",
"font_size": 15,
"font_family": "'Playfair Display', serif",
"font_url": "https://fonts.googleapis.com/css?family=Raleway:400,700&display=swap",
"content": "{{stores}}",
"background_url": "https://cdn-files.placewise.com/files/uuUHXAoLdRIX3Am4SHaR1iGyv8yK6-G_a845txA7HUqYhETqgo9"
}
Definition#
Key | Type | Required? | Description |
---|
number | integer | yes | Number of the rectangle. Must be unique. |
name | string | yes | Identifier of rectangle for user |
width | integer | yes | Width of rendered rectangle |
height | integer | yes | Height of rendered rectangle |
padding | integer | yes | Padding inside of rendered rectangle |
offset_left | integer | yes | x position relative to the top left corner of image |
offset_top | integer | yes | y position relative to the top left corner of image |
text_align | enum: ['left', 'center', 'right'] | yes | Text alignment inside the rectangle |
text_decoration | enum: ['none', 'underline', 'overline', 'line-through'] | no | Default: 'none' |
color | hex (e.g. '#FF00EE' ) | yes | Color of the rectangle text |
font_size | integer | yes | Font size of the rectangle text |
font_family | string | yes | Family definition, related to included font_url |
font_url | URL | yes | URL of font face |
font_style | enum: ['normal', 'italic', 'oblique'] | no | Default: 'normal' |
font_weight | enum: ['normal', 'bold', 'bolder', 'lighter'] | no | Default: 'normal' |
content | string | no | Content to display, may contain merge fields |
background_url | string | no | Background of the rectangle. See below. |
background_url
attribute#
The background image for the rectangle must be uploaded to Files API as offer_template_rectangle_background
.It's identifier must have a following format: "<image_template_id>:<number>"
.
For example, ImageTemplate with id 1441
and with two rectangles with numbers 1
and 2
may have following backgrounds
on its rectangles: "1441:1"
, "1441:2"
.ImageTemplate Merge-fields#
It is possible to use following merge-fields in order to inject offer attributes into the image generated from template.Merge field | Description |
---|
{{name}} | Injects name of offer |
{{description}} | Injects description of offer |
{{collection}} | Injects name of first collection assigned to offer |
{{stores}} | When only one store is assigned to offer, injects it as it is. When more, it injects stores joined with comma |
Modified at 2024-04-22 22:18:12