Get an image

In model

// Original
$img = $this->imageStorage->fromIdentifier('images/ed/kitty.jpg');
dump($img->getPath()); // System path to image file

// Resized etc
$img = $this->imageStorage->fromIdentifier(['images/ed/kitty.jpg', '20x20']);

In template - img macro

{var $identifier = 'images/ed/kitty.jpg'}
{img $identifier}
Output:

In template - img n:macro

<img n:img="$identifier">
Output:

Absolute URL

There are macros for getting absolute urls:

{var $identifier = 'images/ed/kitty.jpg'}
{imgAbs $identifier}
Output:

Identically works macro {imgLinkAbs} and n:macro n:imgAbs.

Resizing (flag), quality)

{img $identifier, '100x100'}
Output:

{img $identifier, '100x200', 'exact'}
Output:

{img $identifier, '100x200', 'fit'}
Output:

{img $identifier, '100x200', 'fill', 100}// Adjust quality to 100%
{img $identifier, '100x200', 'fill'}// 85 by default
{img $identifier, '100x200', 'fill', 10}// Adjust quality to 10%
{img $identifier, '100x200', 'fill', 11}// Adjust quality to 1%
Output:




{img $identifier, '100x200', 'shrink_only'}
Output:

{img $identifier, '100x200', 'stretch'}
Output:

Cropping

{img $identifier, '200x200crop100x150x100x100'}
Output:

Kitty face:
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tím souhlasíte. V pořádku Další informace