If you use __THUMBNAILS__ instead of __THUMB.180.240__. You can set the Maximum width and Maximum height in the gallery defaults. It will create horizontal or vertical thymbs depending of the image.
idk if ppl still uses this script, but is there someway to create thumbnails with responsive height and weight values? for sample, instead adding height and weight (__THUMB.180.240__) script will automatically adjusting the horizontal and vertical of the thumbnails given a max size
here is an example:
https://www.babepedia.com/gallery/NessiQ/383379
in the example above, thumbnails are in horizontal or vertical depending of the image