Keyword

Calling item->image sizes in category?

  • Kelsey Brookes
  • Kelsey Brookes's Avatar Topic Author
  • Offline
  • Elite Member
More
11 years 6 months ago #111207 by Kelsey Brookes
Calling item->image sizes in category? was created by Kelsey Brookes
Is it possible for me to specify in my template override which size version of the item's image I want?

I've implemented a Masonry layout for a K2 category that uses an extra field to determine the width of each news item. At the moment I'm using the medium size image for the category view and letting CSS handle up-or-down scaling of those images.

Ideally I'd like to remove the performance hit of in-browser scaling and serve the images at their native sizes.

Is there any way to specify something like this in my template override? $this->item->image size=XL ?

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

  • Kelsey Brookes
  • Kelsey Brookes's Avatar Topic Author
  • Offline
  • Elite Member
More
11 years 6 months ago #111208 by Kelsey Brookes
Replied by Kelsey Brookes on topic Re: Calling item->image sizes in category?
I wound up figuring it out.

In the Category List View, by default K2 will use whatever size you've set for any of the Item List Leading, Primary or Secondary. When you look at the path if the image pulled, it's using its 'K2 cache name'+the size.

So something along the lines of '3cdjuaskfyuiyi65678_imageXLarge.jpg'

When you look at the code for Category Items, you'll see that it doesn't refer to the image, but that the image size is explicitly set at the start of the document with this:
Log in  or Create an account to join the conversation.