[SOLVED] Add image "orientation" to imageConfig and Image Resource

Knowing an image orientation (portrait/landscape) can be critical when trying to style a page.
Some pages need a different layout depending on the orientation of their header image.
Some Galleries need to style their children images differently according to their orientation.

For now, I believe we could find out the information using .Math alongside .Width and .Height but did not test.

I wonder how complicated it would be to add this extra key to the output of the imageConfig function
and to the Page Resource (of type image) object

Below is the common “image orientation” practice/usage, but some could argue square is landscape…

  • “landscape” (.Width > .Height)
  • “portrait” (.Width < .Height)
  • “square” (.Width == .Height)

JPEG also has EXIF orientation, which we currently does not support …

Yes, your answer makes me realize the “orientation” word is wrong for my request. EXIF “orientation” is more like the orientation of the camera, and later on, the picture if you happen to change the orientation using a software.

This article explains why relying on the EXIF orientation info for website building is error prone:
https://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/

What I meant, is just the look of the picture on the website: Is it taller than wide or wider than tall ?

But this feature is not needed especially when for the use cases mentioned, the guessing is as easy as:

{{ $orientation := cond (ge .Width .Height) "landscape" "portrait" }}

Thanks for your answer.