Thumbnail Image aspect Ratio
-
Hi there,
Having done multiple websites with Laytheme, a thing I always stumble upon is that the thumbail grid is not automatically cropping images to a certain aspect ration.
That means, if you want to have a clean thumbnail grid, you need to upload for each image an extra cropped thumbnail version.
Would be pretty dope if you could set an aspect ration for thumbnails in the settings!Thank and have great day,
Marius -
Dear @ml
This is a great idea and we will write it down for the future. Right now this is not possible.
Thank you!
Marius -
Would love this, very useful :)
-
Enter this css in "lay options" -> "custom css & html" -> "custom css":
.thumb-collection .ph{ padding-bottom: 100%!important; } .thumb-collection .ph img, .thumb-collection .ph video{ width: 100%!important; height: 100%!important; object-fit: cover!important; object-position: center!important; }
this way you will have a thumbnailgrid of just squares.
change the padding-bottom to change the aspect ratio.to have a 16/9 aspect, you would calculate:
9 / 16 * 100 = 56,25
would be:
padding-bottom: 56,25%!important;and u may want to read this
https://developer.mozilla.org/en-US/docs/Web/CSS/object-positionabout the object position css
-
Thanks Armin,
Worked like a charm, would be very useful if there would a way in the future to control it via the Thumb\Element grid visual interface...I've also implemented it for Element Grid:
.elements-collection-region .ph{
padding-bottom: 100%!important;
}.elements-collection-region .element-wrap img,
.elements-collection-region .element-wrap video{
width: 100% !important;
height: 100% !important;
object-fit: cover !important;
object-position: center !important;
} -
I also code custom websites or custom Lay features.
šæ Email me here: šæ
info@laytheme.com
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options ā Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it