API
Images
Resized and re-encoded copies of uploaded images with a query on their URL, for srcset and AVIF or WebP. Width, height, fit, format and quality.
Add a query to an image asset's url for a resized, re-encoded copy (the delivery URL already names w and q; swap them for what a layout needs). Without w or h an image is served at its own width, up to 3840 pixels:
<img
src="https://content.obelism.studio/assets/asset_…/photo.jpg?w=800&q=80"
srcset="…/photo.jpg?w=480&q=80 480w, …/photo.jpg?w=960&q=80 960w"
sizes="(min-width: 60rem) 50vw, 100vw"
width="1600"
height="900"
alt="…"
/>| Parameter | Value |
|---|---|
w, h | Pixels, up to 3840 |
fit | scale-down (default), contain, cover, crop, pad |
format | auto (default: AVIF or WebP when the browser takes them), avif, webp, jpeg, png |
q | Quality, 1–100 (default 80) |
focus | With cover or crop: x,y (0–1 from the top left) to keep in view, or auto |
- PNG, JPEG, GIF and WebP can be transformed; other files, AVIF uploads included, ignore the query and are served as they are.
- Assets carry their
widthandheight, for thewidthandheightattributes, so the page doesn't shift as images load. format=autopicks AVIF for images up to 1200 pixels on their longest side and WebP up to 2400, the sizes Cloudflare can encode them at quickly. Larger copies, such as a 2x hero at 3840, keep the source's format. An explicitformatis used as asked; Cloudflare falls back to WebP or JPEG when an image is too large for AVIF.- Copies are cached like the originals: public, for a year. They ignore
Range. The edge keeps one copy per width, quality andAcceptfor a day, answered withX-Cache: HIT;cf-cache-statusis Cloudflare's separate front cache and saysBYPASSfor a Worker response either way, so it isn't the sign of a miss. q=80is the default, and what delivery names. Re-encoding atq=100can produce a copy several times the original file's size; ask for it only when the image really needs it.- An image's focal point (set by clicking the image in its details, in the Media library or on a picked file in the entry form) comes with the asset as
focalPoint: { x, y }. Pass it asfocuswhen you crop: since it is part of the URL, moving it gives new URLs instead of a year-cached old crop. The SDK'simageUrlandimageSrcSetadd it forcoverandcrop(@obelism/content0.9.0 and later).
With the SDK:
import { imageSrcSet, imageUrl } from '@obelism/content'
const src = imageUrl(asset, { w: 960 })
const srcSet = imageSrcSet(asset, [480, 960, 1440], { format: 'auto' })In Next.js, allow https://content.obelism.studio/assets/** in images.remotePatterns to use next/image, or pass these URLs to a plain <img> and skip Next's optimizer. In a React Router or Hydrogen storefront, use a plain <img> with the srcset above: Hydrogen's <Image> only transforms Shopify CDN URLs with its default loader.