Media format

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.

?width=100

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.

?height=10

format

Converts current asset to a new image format.

Supported image formats: jpg, png, webp, gif

Supported file to image formats: pdf, psd, eps

?format=webp

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.

&mode=boxpad

quality

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

output quality of images that allow lossy processing.

&quality=90

anchor

Anchor positions supported:

  • center

  • top

  • right

  • bottom

  • left

  • topleft

  • topright

  • bottomleft

  • bottomright

Center is default.

&mode=crop&anchor=top

bgcolor

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

&bgcolor=ffffff

Examples

Original

?width=250

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

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

Last updated