Page 1 of 1

how to create a custom column that sort based on images orientation?

Posted: 20 Nov 2019 14:47
by ucok66
Hai, I am curious if there is a way to make a custom column that can sort images based on orientation (portrait, square and landscape).

I already read a topic made by mkolaski viewtopic.php?f=3&t=14504&p=127568, but I still don't know what to do

Re: how to create a custom column that sort based on images orientation?

Posted: 20 Nov 2019 15:00
by highend
By scripting it...

Code: Select all

    $dimensions = property("dimensions", <cc_item>);
    if (!$dimensions) { return ""; }
    $width  = gettoken($dimensions, 1, " x ");
    $height = gettoken($dimensions, 2, " x ");
    if     ($width == $height) { return "square";    }
    elseif ($width > $height)  { return "landscape"; }
    else                       { return "portrait";  }
cc.png

Re: how to create a custom column that sort based on images orientation?

Posted: 20 Nov 2019 15:11
by ucok66
Thank you, this is helpful