Keyword

K2 Catalog Mode - crop images for square thumbnails

More
9 years 3 months ago - 9 years 3 months ago #136455 by alexp
K2 2.6.8
Catalog Mode
Joomla 3.3.0

We've made progress on this but are now stuck again.

Krikor had directed us to CSS to do the cropping.
www.joomlaworks.net/forum/k2-en/38491-solved-k2-catalog-mode-crop-images-for-square-thumbnails

We followed these instructions -
jonathannicol.com/blog/2014/06/16/centre-crop-thumbnails-with-css/
but it's only working for images that are in landscape format. Which the article writer pointed out would happen unless "the portrait format image has the class 'portrait', so that we can correctly scale it to fill its container"

See screenshot-1 (hopefully I used imgur correctly). imgur.com/7GkfFxY

My developer is saying, for those images that are 'portrait', we need to have the class = portrait added in K2.

Is there a way to do that?

Can we create an Extra Field for this? So the client can select that attribute whenever an image is 'portrait'? Sort of tagging it I guess.

Or is there another way to approach this? The goal is that the method is either automatic (preferable) or at least clear for the client when they are uploading item images.

Thanks!
Last edit: 9 years 3 months ago by alexp.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 months ago #136461 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 Catalog Mode - crop images for square thumbnails
Hello,

You can add the portrait class in your K2 overrides.
You can show this link to your dev getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates .

The extrafield seems like an overkill to me since you would have to render both images and only show one depending on the circumstances. Furthermore images from extrafields are not auto-resized.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
9 years 3 months ago #136471 by alexp
Ok, we'll give that a try thanks.

And thanks for your thoughts in regards to the extra fields approach.

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

More
9 years 3 months ago - 9 years 3 months ago #136476 by alexp
The first question that comes up is if we add the portrait class in a K2 override, will it differentiate between whether the uploaded image is either landscape or portrait? So as to not apply the portrait class to every uploaded image ( those that are square or landscape ).
Last edit: 9 years 3 months ago by alexp. Reason: activate auto reply

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

More
9 years 3 months ago #136480 by alexp
K, we've got it working now on the Category page. Next is applying same to K2 subcategories. So close.

Thanks for guidance Krikor. Much appreciated.

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

More
9 years 3 months ago #136481 by alexp
We've got it sorted now. I think we're good to go!

Thank you for the direction Krikor!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 2 months ago #136511 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 Catalog Mode - crop images for square thumbnails
You 're welcome :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum