help to better help you:

Please: add always Joomla / JEM version and details to your posts, so we can try to reproduce your issue!

Square thumbnails with cropped images

Re: Square thumbnails with cropped images

5 years 7 months ago
#26093
I would love to see an option for square thumbnails!

Has anyone had any luck with this?

Please Log in or Create an account to join the conversation.

Re: Square thumbnails with cropped images

5 years 7 months ago
#26096
This might help in the meantime, if you want to extend your Zebra class: stackoverflow.com/questions/6891352/crop-image-from-center-php
Another option would be to specify height and width in your CSS to force square thumbnail image. Can even go step further and create rounded corners or circle image.
The following user(s) said Thank You: mrcraige

Please Log in or Create an account to join the conversation.

Re: Square thumbnails with cropped images

5 years 7 months ago - 5 years 7 months ago
#26099
There is no need to use an external library like Zebra. PHP can resize and crop.
www.php.net/manual/en/function.imagecrop.php

I haven't writen code yet, but I think this is beter than Zebra, since cropping to a square without distorting the image requires extra lines of code with Zebra library. Or rather: you need to crop the image twice to create a square.
Last edit: 5 years 7 months ago by stevent.

Please Log in or Create an account to join the conversation.

Re: Square thumbnails with cropped images

5 years 7 months ago - 5 years 7 months ago
#26100
JEM uses zebra in classes/image_class.php! version 2.2.6
But meanwhile there's version 2.2.7 (a fix thanks to Hoffi!), which should be updated in JEM.
Last edit: 5 years 7 months ago by jojo12.

Please Log in or Create an account to join the conversation.

Re: Square thumbnails with cropped images

5 years 7 months ago - 5 years 7 months ago
#26106
Thanks for your suggestions.

Using transform in css seems to work. I added this to the css file to make square thumbnails in the eventslist.
Code:
.jem-list-img { position: relative; width: 100px; border: 0; overflow: hidden; height: 100px; } .jem-list-img img { -moz-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); position: absolute; top: 50%; left: 50%; width: auto }

I got the idea from here:
stackoverflow.com/questions/25261198/css-cropping-landscape-to-square

An even easier option would simply be
object-fit: cover;
However, it's not supported by older browsers.
Last edit: 5 years 7 months ago by mrcraige.

Please Log in or Create an account to join the conversation.

Time to create page: 0.490 seconds