Can`t show related item`s pictures in K2

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Tue Dec 23, 2014 3:03 pm
Reply with quote
Report this post
I am using your News 2 template with Joomla 3 and K2 2.6.9. Everything is working great, but I can`t show pictures in related items in K2. Could you help me with this?
User avatar
Expert Boarder

teitbite
Wed Dec 24, 2014 9:58 am
Reply with quote
Report this post
Hi

Please tell me the url to the example of a page You want to show related items on.
User avatar
Moderator

GK User
Thu Dec 25, 2014 4:49 pm
Reply with quote
Report this post
User avatar
Expert Boarder

teitbite
Sun Dec 28, 2014 10:52 am
Reply with quote
Report this post
hi

Please edit /html/com_k2/templates/default/item.php find a related elements code (around line 265) and add this for image:

Code: Select all
            <?php if($this->item->params->get('itemRelatedImageSize')): ?>
            <img style="width:<?php echo $item->imageWidth; ?>px;height:auto;" class="itemRelImg" src="<?php echo $item->image; ?>" alt="<?php K2HelperUtilities::cleanHtml($item->title); ?>" />
            <?php endif; ?>

User avatar
Moderator

GK User
Mon Dec 29, 2014 2:38 pm
Reply with quote
Report this post
Hi, this code is already there. Meybe it is about settings. But I don`t know what exactly. Could you please help me with that.
User avatar
Expert Boarder

teitbite
Tue Dec 30, 2014 1:02 pm
Reply with quote
Report this post
Hi

The only way condition will not show is if "itemRelatedImageSize" is not configured, so You may try and find where this can be set. Unfortunatelly I do not know K2 as well to know where this option is.

You may also try replacing the code with:

Code: Select all
<img style="width:<?php echo $item->imageWidth; ?>px;height:auto;" class="itemRelImg" src="<?php echo $item->image; ?>" alt="<?php K2HelperUtilities::cleanHtml($item->title); ?>" />


so no condition will be used and image will be displayed.
User avatar
Moderator

GK User
Mon Jan 05, 2015 1:29 pm
Reply with quote
Report this post
I tried to replace the code with the second one with no condition and still nothing happens. I checked all the possible setting in K2 - nothing again. I even copied everything from your quickstart site ( where the pictures show) and still no success.
User avatar
Expert Boarder

teitbite
Tue Jan 06, 2015 1:13 pm
Reply with quote
Report this post
Hi

Mystery solved :) I've made a dump and looks like images are not showing because You do not have images for articles. All images are set in content and related items are looking for a main image uploaded with a separated tag in K2 add article page.
User avatar
Moderator

GK User
Tue Jan 06, 2015 2:58 pm
Reply with quote
Report this post
Thank you, but I am afraid I don`t understand how to fix this.
User avatar
Expert Boarder

teitbite
Wed Jan 07, 2015 9:04 pm
Reply with quote
Report this post
Hi

The only way to have images in related articles section is to move the first image from content to K2 image section.

PS: You can write a script capable of extraxting first image from content and displaying it instead, but it's an additional functionality, so I cannot help with this, sorry.
User avatar
Moderator

GK User
Thu Jan 08, 2015 1:59 pm
Reply with quote
Report this post
Thank you so much. My problem is that I don`t know how to move an image to K2 image section. How have you achieved this in your quickstart website?
User avatar
Expert Boarder

GK User
Thu Jan 08, 2015 2:10 pm
Reply with quote
Report this post
Sorry for the stupid question, I finally saw how to do this - from image tab in K2 editor. If I do this for 500 articles it will be a lot of work. Maybe I should wait for such plugin compatible with joomla 3.

Thank you so much! Close this topic, please.
User avatar
Expert Boarder

teitbite
Fri Jan 09, 2015 10:07 pm
Reply with quote
Report this post
Hi

If it's 500 articles than I would leave it like it is now and starting to use K2 images. With time You will have all related articles filled with images.
User avatar
Moderator

GK User
Sat Jan 10, 2015 5:44 pm
Reply with quote
Report this post
OK, thank you. And is there a way to use one of your modules and put it under my K2 articles to show categories with pictures for example?
User avatar
Expert Boarder

teitbite
Sun Jan 11, 2015 9:29 pm
Reply with quote
Report this post
Hi

Sorry, but none of our modules is capable of showing a category picture. You need to look for a different module for that.
User avatar
Moderator

GK User
Mon Jan 12, 2015 9:40 am
Reply with quote
Report this post
Thanks :)
User avatar
Expert Boarder

GK User
Tue Jan 13, 2015 4:23 pm
Reply with quote
Report this post
Hi, I just want to note that dispite I put image in the image section to be the main image of the article, it still does not appear in the related items pictures. There might be another problem then.
User avatar
Expert Boarder

GK User
Wed Jan 14, 2015 3:14 pm
Reply with quote
Report this post
I am thinking that here some code for the img is missing: <?php foreach($this->relatedItems as $key=>$item): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?>">

<?php if($this->item->params->get('itemRelatedTitle', 1)): ?>
<a class="itemRelTitle" href="<?php echo $item->link ?>"><?php echo $item->title; ?></a

<?php endif; ?>
I see only code for the link to title, but not for the image.
User avatar
Expert Boarder

teitbite
Fri Jan 16, 2015 4:23 pm
Reply with quote
Report this post
Hi

Looks like it's still the same issue. I've made a dump of the related article and still there is nothing assigned to "image" value. Please send me an access to joomla panel, so I'll check settings for this articles.
User avatar
Moderator

teitbite
Sun Jan 18, 2015 4:20 pm
Reply with quote
Report this post
Hi

Finally :) A size of the related image was not selected i category settings. I've selected "medium" and now the image is there.
User avatar
Moderator

GK User
Mon Jan 19, 2015 8:54 am
Reply with quote
Report this post
Thank you so much! You are the best :)
User avatar
Expert Boarder

GK User
Mon Jan 19, 2015 2:50 pm
Reply with quote
Report this post
I want to ask you something. I noticed something strange when I logged in and open the last K2 Item. The buttons of the editor (Tyny MCE) were misssing and all the articles are swithed to source code. Did you change something or the problem is in me?
User avatar
Expert Boarder

GK User
Mon Jan 19, 2015 3:49 pm
Reply with quote
Report this post
Ok, I guess the problem is in me. I turned off all the other editors and it appeared again. Sorry to bother you :)
User avatar
Expert Boarder

GK User
Tue Jan 20, 2015 8:54 am
Reply with quote
Report this post
Hi, me again. Sorry I am really confused. Where have you found in categories this option for medium size of related item`s by tag? I found it in the main category that other categories inherit (лични финанси) , but when I change it there, nothing happens at the front end. And I can`t find such an option in K2 general options.
User avatar
Expert Boarder

teitbite
Wed Jan 21, 2015 8:50 pm
Reply with quote
Report this post
Hi

You have 2 categories with the same name: "Лични финанси". I have changed it in the one with ID 143
User avatar
Moderator

GK User
Thu Jan 22, 2015 10:03 am
Reply with quote
Report this post
O, I feel stupid :) You are the best, really :)
User avatar
Expert Boarder

teitbite
Sat Jan 24, 2015 12:42 pm
Reply with quote
Report this post
Hi

I may know this things now, but trust me I had no idea how to deal with this things some time ago. Anyway, that's really great we got this thing sorted out :)
User avatar
Moderator

GK User
Sat Jan 24, 2015 5:07 pm
Reply with quote
Report this post
It`s good you found a way to deal with this things with this little angel at your shoulders. :) I have one myself - the same age. Thank you for your help :)
User avatar
Expert Boarder

teitbite
Mon Jan 26, 2015 9:26 pm
Reply with quote
Report this post
Hi

That's an old photo :) This one has 7 years already. But the new model is about his size, just needs much more attentions the first one needed ;/ :)
User avatar
Moderator

GK User
Tue Jan 27, 2015 12:11 pm
Reply with quote
Report this post
:)
User avatar
Expert Boarder


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.