Does Kirby 3 have a way to retrieve the image orientation such as “portrait”, “landscape”, or “square”?
Yay! So would the implementation would be something like…?
$orientation = Dimensions::forImage($image)->orientation()
<?php foreach ($page->images() as $image) : ?>
<?php dump($image->dimensions()->landscape());?>
<?php endforeach ?>
Will return true is the image is a landscape image.
orientation()
will return the orientation instead.
<?php dump($image->dimensions()->orientation());?>
Shortcuts are also possible:
<?php dump($image->isPortrait()); ?>
<?php dump($image->isLandscape()); ?>
<?php dump($image->isSquare()); ?>
<?php dump($image->orientation()); ?>
1 Like
The code you posted above will not work, because the expected parameter is a string (root of file), not an image object.
1 Like