image-1

Serve, resize and crop images.

Supported formats

The supported image formats are

image/jpeg
image/png
image/gif

.Inline method

Render an image as an <img> tag.

About the <img> tag:

  • the file’s title is used in the alt attribute if it is not empty,
  • the image resolution is limited in 1024px x 1024px, in contain mode (see .Request method parameters),
  • the image is horizontally centered via CSS (inline style),
  • the image is cached on client side via the o1-cache query paramter,
  • the resized image is cached on server side to avoid repetitive resizing.

Example output:

<img src="/image.png?o1-cache=4c257a4b61&amp;width=1024&amp;height=1024" alt="Image file title" style="max-width:100%; display:block; margin:auto;">

.Request method

Resize and serve raw image data.

Parameters

width       Optional image width. If provided, `height` must also be provided,
            and the two values must match. Must be one of [16, 24, 32, 48,
            64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048] for
            caching purposes.

height      Optional image height. If provided, `width` must also be provided,
            and the two values must match.

mode        Optional, one of ['cover', 'contain']. Defaults to 'contain'.
            When 'contain' is selected, the image will be fitted into the
            box specified by the width/height parameters. So to say, the box
            specified by width/height will contain the image.
            When 'cover' is selected, the image will cover said box. Note
            that unless the original image is has a square size, the returned
            image will be greater than the requested width/height.

Implemented OS Interfaces

.Image
.Inline
.Request