Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to format assets

Struct PIM supports formatting media directly through its media module based on querystring parameters.

The media module delivering assets provides methods to perform various manipulation functions on a given image or file based on querystring parameters.

Supported query parameters

Parameter
Description

width

For mode Pad passing just one dimension will automatically preserve the aspect ratio of the original image.

For mode BoxPad when upscaling an image the image pixels themselves are not resized, rather the image is padded to fit the given dimensions. If downscaling it will behave the same as Pad.

height

For mode Pad passing just one dimension will automatically preserve the aspect ratio of the original image.

For mode BoxPad when upscaling an image the image pixels themselves are not resized, rather the image is padded to fit the given dimensions. If downscaling it will behave the same as Pad.

format

Converts current asset to a new image format.

Supported image formats: jpg, png, webp, gif

Supported file to image formats: pdf, psd, eps

mode

The following modes are supported:

  • Pad Passing a single dimension will automatically preserve the aspect ratio of the original image. If the requested aspect ratio is different then the image will be padded to fit. Widths and heights can optionally also be passed as a ratio This is default.

  • BoxPad When upscaling an image the image pixels themselves are not resized, rather the image is padded to fit the given dimensions. When downscaling the image is resized using the rules defined by Pad

  • Crop Resizes the image to the given dimensions. If the set dimensions do not match the aspect ratio of the original image then the output is cropped to match the new aspect ratio.

quality

Alters the output quality of the current image. This method will only effect the

output quality of images that allow lossy processing.

anchor

Anchor positions supported:

  • center

  • top

  • right

  • bottom

  • left

  • topleft

  • topright

  • bottomleft

  • bottomright

Center is default.

bgcolor

When padding applied and or image includes transparency, it is possible to set the color of the padding/baggrund.

mode=min

Resizes the image until its shortest side reaches the given dimension, preserving the aspect ratio. The image is never upscaled. An image smaller than the specified size is returned in its original size. Replaces upscale=false from v3.

mode=max

Resizes the image to fit within the given dimensions, preserving the aspect ratio. No padding is added, so one side may be smaller than requested. E.g. 100×40 on a square image gives 40×40.

mode=stretch

Resizes the image to the given dimensions, ignoring the aspect ratio of the original image.

rxy

Sets the focal point used when cropping, given as x,y values between 0 and 1, where 0,0 is the top left corner. Gives more precise control than anchor when the subject is not centered.

rcolor

Sets the color of the padding only. Unlike bgcolor, transparent areas of the image are kept transparent.

preservemetadata

Keeps the EXIF, IPTC and XMP metadata of the image. By default metadata is removed. The ICC color profile is always kept.

Examples

Original

?width=250

?width=550&height=550&mode=crop&anchor=left

?width=1100&height=1100&mode=boxpad&bgcolor=lightblue

Last updated