processwire-requests
processwire-requests copied to clipboard
Please add ->isPortrait property to Pageimage objects
Often in designs we have to treat images differently if they are higher than wide. Code like this bloats templates and needs more cognitive power to understand:
if($img->height > $img->width) {
...
}
It would be great to have an "isPortrait" property:
if($img->isPortrait) {
...
}
This one will be very handy if added.
@BernhardBaumrock I add a hook that creates a property/method to work with all orientations in pretty much every project now. Perhaps provides more utility, or present in addition to isPortrait?
$image->orientation; // 'portrait', 'landscape', 'square'
$image->orientation(); // 'portrait, 'landscape', 'square'
$image->orientation('portrait'); // boolean
$image->orientation('landscape'); // boolean
$image->orientation('square'); // boolean