> For the complete documentation index, see [llms.txt](https://docs.sort-me.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sort-me.org/tricky/images.md).

# Images

Sort Me hosts their images, such as avatars or problem legend illustrations, on their own server. It converts images to WebP and creates multiple formats for displaying on a different parts of website.

## Upload new image

<mark style="color:green;">`POST`</mark> `https://sort-me.org/images/upload`

Pass the image in `document` form-data field.

{% tabs %}
{% tab title="200: OK Image uploaded" %}

```json
{
    "id": "04c1bec1-e71a-4a73-b023-267db3a4dc30"
}
```

{% endtab %}
{% endtabs %}

## Get image

<mark style="color:blue;">`GET`</mark> `https://sort-me.org/images/get/{id}`

Get image; if possible, resize it to desired size.

For now, supported sizes are:

`avatar` - 128x128, cropped to square\
`avatar-big` - 512x512, cropped to square

If you provide unknown size or not provide it at all, image will be returned in their default aspect ratio, resized to 1600px or less in width. This may change in future.

Images are always returned in WebP format.

#### Path Parameters

| Name                                 | Type   | Description                          |
| ------------------------------------ | ------ | ------------------------------------ |
| id<mark style="color:red;">\*</mark> | string | UUID of previously uploaded picture. |

#### Query Parameters

| Name | Type   | Description     |
| ---- | ------ | --------------- |
| size | string | Size of picture |

{% tabs %}
{% tab title="200: OK \<image/webp response>" %}

{% endtab %}

{% tab title="404: Not Found Image not found" %}

```json
{"error": "image not found"}
```

{% endtab %}
{% endtabs %}
