Images
Loby provides a fully functional image generator, that dynamically generates images for requested sizes. The images are quickly generated and cached for fast reuse.
Upload
POST /images
Upload an image. The body is JSON with a data-URL in base64Data.
| Property | Type | Description |
|---|---|---|
base64Data | string | Data-URL, for example data:image/png;base64,.... The part before ;base64, must include a MIME type. |
{ "base64Data": "data:image/png;base64,iVBORw0KGgo..." }
Returns { "id": "..." }. Use that id in avatar fields and in the CDN URL below.
If base64Data is missing, the response is 400 with BASE64_DATA_MISSING. If the data-URL is not a valid data:<mime>;base64,<payload> string, the response is 400 with BASE64_DATA_INVALID.
URL Format
Use the following url for generating images:
https://img.loby.io/{{imageId}}_{{sizingType}}{{size}}.{{format}}
| Component | Description | Example |
|---|---|---|
imageId | The id of the image | 6ef7d631-b898-40a4-ba27-b8c772f6db03 |
sizingType | There are 3 options: w, h and s. By choosing w, image is sized according to width. h according to height and s will square crop the image and size according to both sides | w |
size | The size according to the sizing type | 1280 |
format | You can choose between jpg and png | jpg |
Example
https://img.loby.io/6ef7d631-b898-40a4-ba27-b8c772f6db03_w1280.jpg