Skip to content

Image Transformation ​

The /m/:key path serves media files from the CDN. For images, you can request on-the-fly resizing and format conversion.

Base URL ​

Media is served from https://cdn.atiru.io by default. If you configured a custom CDN, use your public_url_base instead.

Path: GET /m/:key

The :key is the file's file_id from the upload response.

Query parameters (images only) ​

ParameterDescriptionMax value
widthResize to this width (pixels). Aspect ratio preserved if height is omitted.2000
heightResize to this height (pixels). Aspect ratio preserved if width is omitted.2000
formatOutput format. One of: webp, avif, png, jpeg-

You can combine parameters: ?width=200&height=200&format=webp

Examples ​

Original image (no transformation)

https://cdn.atiru.io/m/abc123

Resize to 200px width (height auto)

https://cdn.atiru.io/m/abc123?width=200

Resize to 200x200 thumbnail

https://cdn.atiru.io/m/abc123?width=200&height=200

Convert to WebP

https://cdn.atiru.io/m/abc123?format=webp

Thumbnail in WebP

https://cdn.atiru.io/m/abc123?width=100&height=100&format=webp

HTML

html
<!-- Original -->
<img src="https://cdn.atiru.io/m/abc123" alt="My image" />

<!-- Thumbnail -->
<img src="https://cdn.atiru.io/m/abc123?width=200&height=200" alt="Thumbnail" />

<!-- Responsive with WebP -->
<img
  src="https://cdn.atiru.io/m/abc123?width=400&format=webp"
  srcset="
    https://cdn.atiru.io/m/abc123?width=400&format=webp 400w,
    https://cdn.atiru.io/m/abc123?width=800&format=webp 800w
  "
  alt="Responsive image"
/>

curl

bash
curl -o thumbnail.png "https://cdn.atiru.io/m/abc123?width=200&height=200&format=png"

Passthrough types (no transformation) ​

These file types are served as-is on /m/:key—no resize or format conversion:

  • Video: video/mp4, video/webm, video/ogg, etc.
  • Audio: audio/mpeg, audio/wav, audio/ogg, etc.
  • PDF: application/pdf
  • Fonts: font/woff, font/woff2, font/ttf, etc.

Query parameters (width, height, format) are ignored for these types.

Caching ​

Responses include Cache-Control: public, max-age=31536000 (1 year). CDNs can cache aggressively for fast delivery.

Limits ​

  • Max dimension: 2000 pixels for width and height
  • Rate limiting: See Rate Limiting. Image requests with resize/format may return 503 when the server is busy—retry with Retry-After header.