Keyword

Category Item image change size

  • Nuno Costa
  • Nuno Costa's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago - 11 years 5 months ago #120440 by Nuno Costa
Category Item image change size was created by Nuno Costa
Hi,

When a new item is published in a category, it will change the size of the images of the items previously published, making them larger.

But it only happens in one column format.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 5 months ago #120441 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Category Item image change size
Hello Nuno,

This sounds like a template specific solution. Please use the default template to browse these links. If the issue persists, let me know and post a link so I can see the actual issue.

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

  • Nuno Costa
  • Nuno Costa's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #120442 by Nuno Costa
Replied by Nuno Costa on topic Re: Category Item image change size
Hi,

First I'm using a default template override, in which the only modification I made was to fix the button style "Redmore" (category_item.php). Therefore, the files from the default directory are virtually unchanged.

Regarding my problem with images, I tried various combinations of one or more columns and image sizes (xlarge, large, medium, small) and none of the default size was recognized, or more correctly the k2 is not applying the default sizes to the images.

I have my website offline. If you want it you can send a password and user to allow access to your site.

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

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 5 months ago #120443 by Yiota
Replied by Yiota on topic Re: Category Item image change size
Hello,

Please if you could provide us access would be most helpful.

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

  • Nuno Costa
  • Nuno Costa's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #120444 by Nuno Costa
Replied by Nuno Costa on topic Re: Category Item image change size
I'll ask you a silly question.

I am not able to find the option to send private messages in the forum. How can I send you a private message with the information.

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

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 5 months ago #120445 by Yiota
Replied by Yiota on topic Re: Category Item image change size
Yes, I'm afraid that this forum doesn't have PMs. Use the contact form instead.

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

  • Nuno Costa
  • Nuno Costa's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #120446 by Nuno Costa
Replied by Nuno Costa on topic Re: Category Item image change size
ok!

I have already submitted the information required through contact form

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

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 5 months ago #120447 by Yiota
Replied by Yiota on topic Re: Category Item image change size
You issue for the image always being as large is the container is this class

body #k2Container.itemListView .itemList #itemListPrimary .catItemImage img

this class has a width:100% !important; if you remove that then your image will be the size you have set up in the K2 parameters of category.

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

  • Nuno Costa
  • Nuno Costa's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #120448 by Nuno Costa
Replied by Nuno Costa on topic Re: Category Item image change size
Hi,

I inserted the following code in my template_custom.css file to make the override of thirdpartyk2.css file but is not working.

body #k2Container.itemListView .itemList #itemListPrimary .catItemImage img {
margin: 10px 0 5px 0;
padding: 0;
max-width: 100%;
width: 100%;
border: 1px solid rgba(0,0,0,0.4);
}

I used Chrome to inspect and get the code so I know that removing the !important the override should be working ... can point me what I'm doing wrong.

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

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 5 months ago #120449 by Yiota
Replied by Yiota on topic Re: Category Item image change size
Try with width:auto !important;

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

  • Nuno Costa
  • Nuno Costa's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago - 11 years 5 months ago #120450 by Nuno Costa
Replied by Nuno Costa on topic Re: Category Item image change size

Try with width:auto !important;


It worked, but did not solve my problem problem completely.

The image took over the default size but still will not let me change the size.

More precisely, if I change the image size using the category default sizes large, medium, small, and so on, the image takes on the dimensions that are defined in the default parameters... but if I change the dimensions in categories parameters, the new dimensions are not recognized keeping the originals.

Another thing, when I changed to "width: auto !important" the image was centered, but applying "float: left" was fixed.

PS: I also tried using the "inherit !important" but the result was the same.

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

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 5 months ago #120451 by Yiota
Replied by Yiota on topic Re: Category Item image change size
OK. The image once uploaded is being resized into 5 sizes according to the K2 Parameter sizes. Which means that if you are loading the Medium size and the image has size 400px when you put a different size through the category parameters the image size doesn't change. In fact the new width size is just added through a style="width: category_image_width" in your case 100px;
In order for this size to override all others you need to edit the category_item.php file of your template overrides and locate this code
<img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
and change it to this code
<img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px !important; height:auto;" />

This will tell your image to always be sized according to the size you provide through the category parameters.

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

  • Nuno Costa
  • Nuno Costa's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #120452 by Nuno Costa
Replied by Nuno Costa on topic Re: Category Item image change size
This correction in addition to having solved the problem also allowed me to dispense override it had done previously.

I also noticed that this problem with the image default sizes also happened with the item ... I did the same correction in the item.php file and also solved the problem.

thank you! :)

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

  • Yiota
  • Yiota's Avatar
  • Visitor
11 years 5 months ago #120453 by Yiota
Replied by Yiota on topic Re: Category Item image change size
You are welcome.

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


Powered by Kunena Forum