Keyword

K2 XS Image Size

  • Milan Sadil
  • Milan Sadil's Avatar Topic Author
  • Offline
  • New Member
More
5 years 2 months ago - 5 years 2 months ago #173121 by Milan Sadil
K2 XS Image Size was created by Milan Sadil
Recently updated Joomla and all extensions, so K2 as well. Now I have problem with K2 Item Images on front page (www.horackova.cz; please be informed that not all items on front page are new, some of them were created with K2 older version). On a previous version of site (www.horackova.eu) image covered a whole container for an image, but on the new version a height if generated XS images is not enough to cover a whole container for an image, so a white strip is displayed under an image.

How I can say new K2 to generate the same image size as with the older one?
Last edit: 5 years 2 months ago by Milan Sadil.

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

More
5 years 2 months ago #173123 by JoomlaWorks
Replied by JoomlaWorks on topic K2 XS Image Size
First make sure your main image settings in the K2 component settings as well as the image settings inside your categories are correct.

Then use this CLI PHP script to re-generate all K2 images with your new dimensions configured: github.com/getk2/rebuildK2imageCache

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

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

  • Milan Sadil
  • Milan Sadil's Avatar Topic Author
  • Offline
  • New Member
More
5 years 2 months ago #173124 by Milan Sadil
Replied by Milan Sadil on topic K2 XS Image Size
Double checked that K2 settings for images on the old and new site are the same.

I don't think it is needed to re-generate K2 images cache. The problem regards only images that were attached to articles which were created after an update. And I can confirm that width of such images is as configured in K2 settings for XS images - 197 px. What is different is their height. For example on both sites there is the same image - on old site its height is 154 px, on new one only 131 px:

new: horackova.cz/media/k2/items/cache/7a49b291438247a3694ae6d80802eedb_XS.jpg
old: horackova.eu/media/k2/items/cache/a2573324950e4c6a90cf85a14e9c0cbc_XS.jpg

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

More
5 years 2 months ago #173125 by JoomlaWorks
Replied by JoomlaWorks on topic K2 XS Image Size
K2 controls the width only. Height is always proportional. If you refer to the frontend view, then it's just a matter of display/templating. It's not a K2 issue.

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

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

  • Milan Sadil
  • Milan Sadil's Avatar Topic Author
  • Offline
  • New Member
More
5 years 2 months ago #173126 by Milan Sadil
Replied by Milan Sadil on topic K2 XS Image Size
I understand your words, but images are really generated in different sizes (197x154 - old vs 197x131 - new, you an easily check using hyperlinks from my previous post). But perhaps there is a custom solution (.css, or .php override) that causes the problem. Can I ask to provide a hint where I should search for an override that changes a height of XS image which is saved into /media/k2/items/cache directory when an image is added as an article (item) image?

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

More
5 years 2 months ago #173127 by JoomlaWorks
Replied by JoomlaWorks on topic K2 XS Image Size
The CSS is being enforced by your template's custom.css file: jmp.sh/Bsi49Y0 (see bottom-right)

It's not a K2 issue.

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

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

  • Milan Sadil
  • Milan Sadil's Avatar Topic Author
  • Offline
  • New Member
More
5 years 2 months ago #173136 by Milan Sadil
Replied by Milan Sadil on topic K2 XS Image Size
I am not such an expert as you, but please let me clarify the situation further. The css mentioned by you is valid for a frame (205 x 164 px). And this frame is on both - the new and the old one - the same. But what is different is an image inside - in case of horackova.eu it is 197 x 154 px (paste.pics/6NN2T), in case of horackova.cz it 197 x 143 px paste.pics/6NN2E. From the screenshosts it is also possible to reveal that XS image on case of horackova.eu is cropped on left and right side, but the XS image on horackova.cz not.

Do you know what code manages uplaoding images to /media/k2/items/cache directory and where corresponding parameters are loaded from? (Is it /media/k2/assets/vendors/verot/class.upload.php/src/class.upload.php file)?

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

More
5 years 2 months ago #173137 by JoomlaWorks
Replied by JoomlaWorks on topic K2 XS Image Size
Again, it has NOTHING TO DO WITH K2 :)

It's purely a CSS issue.

Change the CSS around line 478 in www.horackova.cz/templates/zshorackova/css/custom.css to:
div.atspl-novinky div.k2ItemsBlock ul li div.moduleItemIntrotext a.moduleItemImage img {
    padding: 0;
    margin: 3px 0 0 4px;
    border: 0;
    width: 196px;
    height: 156px;
    object-fit: cover;
}

The last 3 lines will make the images fit exactly into their blue frames.

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

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

  • Milan Sadil
  • Milan Sadil's Avatar Topic Author
  • Offline
  • New Member
More
5 years 2 months ago #173142 by Milan Sadil
Replied by Milan Sadil on topic K2 XS Image Size
You suggested CSS really helped in our situation, really appraciate your kind effort to help (and as I can see from other topics on K2 forum, it is not exceptional).

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

More
5 years 2 months ago #173143 by JoomlaWorks
Replied by JoomlaWorks on topic K2 XS Image Size
Glad it's resolved for you.

Fotis / 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