Swell's file CDN supports basic size transformations for image files by appending query parameters to the file URL. To request a specific sized image from the CDN, take the url field from the file object and add parameters for width, height, or both with the size in pixels as the value. See the reference and examples below for more details on how each parameter works.

Integer

Sets maximum width of the image in pixels. Original aspect ratio is preserved if no height value is provided. When used in conjunction with height, image will be cropped or padded depending on the anchor and padded values.

Integer

Sets maximum height of the image in pixels. Original aspect ratio is preserved if no width value is provided. When used in conjunction with width, image will be cropped or padded depending on the anchor and padded values.

top|right|bottom|left

Affects cropped area when both width and height are specified, or what side white space is added when padded=true. Note that cropping is always performed on the shortest side(s) of the image.

Boolean

Indicates the image should be padded with white space to fit within the desired width and height. Use in conjunction with anchor to specify where the white space should be added. Note that padding is always added to the longest side(s) of the image.

CDN transform parameter examples