Real photo sets are rarely all one shape. A shoot might mix tall portrait shots, wide landscapes and the odd square crop. Put them in a rigid grid and something has to give: pictures get cropped, squashed or surrounded by awkward gaps.
This guide explains how orientation is worked out, why some photos turn up sideways, and how to lay out mixed galleries so every picture looks the way it was taken.
Three shapes, not two
It is easy to think of photos as either portrait or landscape. In practice there are three cases worth treating separately:
- Portrait - taller than it is wide, such as a 2:3 or 4:5 shot.
- Landscape - wider than it is tall, such as 3:2 or 16:9.
- Square - width and height are equal, common for cropped social-style images.
Square images deserve their own category. If a system forces them into portrait or landscape, they end up in the wrong group or vanish when someone filters. Treating square as its own case keeps filters honest.
How orientation is detected
The simple method is to compare width and height: if the width is bigger, it is landscape; if the height is bigger, portrait; if equal, square. That works for many files, but not all of them.
The rotation tag problem
Many cameras and phones save the image data in the sensor's natural direction and then record how the camera was held in a rotation tag inside the file's EXIF metadata. Image viewers that read the tag show the photo upright. Software that ignores it shows the raw data, which may be on its side.
So a photo might be stored as 6000 x 4000 pixels (which looks landscape) with a tag saying "rotate 90 degrees", meaning it is really a 4000 x 6000 portrait. Going by dimensions alone gets it wrong.
| Stored size | Rotation tag | Real orientation |
|---|---|---|
| 6000 x 4000 | None or 0 degrees | Landscape |
| 6000 x 4000 | 90 or 270 degrees | Portrait |
| 4000 x 6000 | None or 0 degrees | Portrait |
| 4000 x 4000 | Any | Square |
The reliable approach is to read both the dimensions and the rotation tag, and work out the orientation from the two together. The same applies to video, which can also carry rotation metadata from phones.
Layouts that suit mixed sets
Different gallery layouts handle mixed shapes in different ways. There is no single best one; it depends on the set and the site.
| Layout | How it works | Good for |
|---|---|---|
| Grid | Equal-sized cells in rows and columns | Sets that are mostly one shape; tidy overviews |
| Masonry | Columns of images at their natural heights, packed together | Mixed portrait and landscape sets |
| List | One image per row, larger, often with details | Browsing carefully, admin review |
A grid does not have to crop. Images can be fitted inside each cell with their full shape preserved, leaving a little space around them. That looks calmer than cutting off heads and feet to make everything the same shape.
Why to avoid forced cropping
Cropping every thumbnail to a square or fixed ratio is quick, but it often removes the very part of the picture that matters. A portrait cropped to landscape loses the top and bottom; a wide scene cropped to square loses the sides. It is better to keep the aspect ratio and let the layout adapt, or to crop only where you have chosen to, around a point you trust to keep the subject in frame.
Never stretch or squash an image to fit a box. Distortion is far more noticeable than a bit of empty space.
Filtering by orientation
An orientation filter lets visitors and admins narrow a set to just the shape they want. It is handy for:
- Viewing on a phone, where portrait images fill the screen nicely.
- Choosing wide images for banners or desktop wallpapers.
- Picking a cover image that suits the site's layout.
- Spotting a set that is unexpectedly all one shape.
A sensible filter offers portrait, landscape and both, and handles square images explicitly rather than hiding them by accident. Behind the scenes, the filter is only as good as the orientation data, which is another reason to get detection right on upload. If you are still preparing your folders, our guide to uploading image and video sets in folders covers the earlier steps.
Lightbox and full-size viewing
However the thumbnails are laid out, clicking one should open the full picture in a fullscreen lightbox, scaled to fit the screen without cropping. Keyboard navigation (arrow keys to move, Escape to close) and zoom make it comfortable to work through a long set. Videos in the same set should play in place rather than forcing a download - and they will only do that reliably if they use a browser-friendly video format.
How Members CMS handles this
When Members CMS processes an image, it corrects the EXIF rotation, so the portrait and landscape filter in each set's gallery works from the way the photo was really taken. How square images are treated is configurable, so they do not end up hidden by accident. You can also filter the Media Library by orientation, alongside status, category, media type and dates.
Each set's gallery offers grid, masonry and list views, and thumbnails are fitted inside a square without ever being cropped or enlarged. The lightbox supports keyboard, swipe, fullscreen, zoom to full resolution and video playback with seeking. Where tour and members-area frames do crop a picture, each image's focus point keeps the subject in view - see cropping photos without cutting heads. Thumbnails and previews are separate files, and originals stay as uploaded unless you turn on image size reduction.
Frequently asked questions
Why does a photo look sideways in some places but not others?
Many cameras save the picture in one direction and record the real orientation in a rotation (EXIF) tag. Software that ignores the tag shows it the wrong way round, so orientation should be worked out from the dimensions and the rotation tag together.
Is a square image portrait or landscape?
Neither. Treat square images as their own case so a filter for portrait or landscape does not hide them or put them in the wrong group by accident.
Should gallery thumbnails be cropped to the same shape?
It is better not to. Preserving the aspect ratio, for example in a masonry layout, shows each picture as it was taken and avoids cutting off the important part.
