Media (OrchardCore.Media)Link

The Media modules provides a UI to upload and organize binary files that can be used while creating content.

The media processing liquid filters can also create custom sized images.

HTML filtersLink

The following filters allow for media manipulation:

asset_urlLink

Returns the url of a media based on its location in the media library.

InputLink

{{ 'animals/kittens.jpg' | asset_url }}

OutputLink

/media/animals/kittens.jpg

img_tagLink

Renders an <img src /> HTML tag.

InputLink

{{ 'animals/kittens.jpg' | asset_url | img_tag }}

OutputLink

<img src="/media/animals/kittens.jpg" />

OptionsLink

alt (Default)Link

The alternate text attribute value

Image resizing filtersLink

resize_urlLink

Convert the input url to create a dynamic image with the specified size arguments.

InputLink

{{ 'animals/kittens.jpg' | asset_url | resize_url: 100, 240 | img_tag }}

OutputLink

<img src="/media/animals/kittens.jpg?width=100&height=240" />

ArgumentsLink

The width and height arguments are limited to a specific list of values to prevent malicious clients from creating too many variations of the same image. The values can be 16, 32, 50, 100, 160, 240, 480, 600, 1024, 2048.

width (or first argument)Link

The width of the new image. One of the allowed values.

height (or second argument)Link

The height of the new image. One of the allowed values.

mode (or third argument)Link

The resize mode.

padLink

Pads the resized image to fit the bounds of its container. If only one dimension is passed, will maintain the original aspect ratio.

boxpadLink

Pads the image to fit the bound of the container without resizing theoriginal source. When downscaling, performs the same functionality as pad.

max (Default)Link

Constrains the resized image to fit the bounds of its container maintaining the original aspect ratio.

minLink

Resizes the image until the shortest side reaches the set given dimension. Upscaling is disabled in this mode and the original image will be returned if attempted.

stretchLink

Stretches the resized image to fit the bounds of its container.

CREDITSLink

ImageSharpLink

https://sixlabors.com/projects/imagesharp/

Copyright 2012 James South Licensed under the Apache License, Version 2.0