K2 article image when shared

GK User
Thu Nov 01, 2012 2:10 pm
my website is www.jags.in

When i use the Facebook 'like' shortcut at the bottom of a k2 article, it shows the author image for the article preview on facebook rather than the image in the article. any way to change this?
User avatar
Senior Boarder

teitbite
Thu Nov 01, 2012 2:19 pm
Hi

Please check if You have plg_gk_opengraph installed and enabled.
User avatar
Moderator

GK User
Thu Nov 01, 2012 2:51 pm
I cant seem to find it in the Plug ins section.
where can i install it from?
User avatar
Senior Boarder

teitbite
Thu Nov 01, 2012 5:19 pm
Hi

You can find it in rest_files package for this template.
User avatar
Moderator

GK User
Fri Jan 10, 2014 3:07 pm
Hi

The problem seems to have started happening again, even though i have the above mentioned plugin installed.

is it due to the gravatar avatars? should i manually upload the author avatar images or something?
User avatar
Senior Boarder

GK User
Mon Jan 13, 2014 12:03 pm
Can anyone help me out?
User avatar
Senior Boarder

teitbite
Wed Jan 15, 2014 7:01 am
Hi

You need to tell me what is the problem now. Last time this was solved, so I suspect the problem is different now, may only result looks the same. Please show me some examples.
User avatar
Moderator

GK User
Thu Jan 23, 2014 11:55 am
So this is what happens when we click the 'Like' button at the bottom of an article
It shows the authors Gravatar on most occasions, not all. Should i try changing the avatar image(s) of all the authors?
Image
User avatar
Senior Boarder

teitbite
Fri Jan 24, 2014 3:39 am
Hi

I think I know what the problem is. You need to add an image as article image. There is a separate field for that. If it's included in text than it ignores it and takes the first image it can find which is an author image.
User avatar
Moderator

GK User
Thu Feb 13, 2014 8:22 am
So I have been putting an Article image in the article image field, however it still picks up the author image..
User avatar
Senior Boarder

teitbite
Fri Feb 14, 2014 9:16 pm
Hi

Ok. Lets try a drastic measures. Edit file /html/com_k2/default/item.php and add this code at top of this file:

Code: Select all
<?php !empty($this->item->image): ?>
<script type="text/javascript">(function($) {$(document).ready(function() {
<meta property="og:image" content="<?php echo $this->item->image; ?>" />
});})(jQuery)</script>
<?php endif; ?>
User avatar
Moderator

teitbite
Fri Feb 14, 2014 9:19 pm
Hi again.

I've just noticed that You have no open graph plugin running. If the code above will not work as expected than You should just look for an extra plugin. But maybe this time try in joomla extention page.
User avatar
Moderator

GK User
Mon Feb 17, 2014 11:46 am
Hi

I have this Open graph plugin currently enabled

plg_gk_opengraph , shouldn't that be doing the job?
User avatar
Senior Boarder

teitbite
Wed Feb 19, 2014 6:52 pm
Hi

I'm guessing it should, but there is no such informations in code at all. I think this plugin doesn't support K2 articles. Please try instal one that does. That would be fastest way to make it work.
User avatar
Moderator

GK User
Thu Mar 13, 2014 7:43 am
Would this Plugin do the trick? It is a FB opengraph plugin for K2 that lets you edit information including Image.

http://extensions.joomla.org/extensions ... ions/23726
User avatar
Senior Boarder

teitbite
Thu Mar 13, 2014 9:50 pm
Hi

I cannot tell for sure, becuase I do not know this plugin. Best way is to just try it and see if it works.
User avatar
Moderator

GK User
Fri Mar 14, 2014 12:37 pm
Hi

I was trying out the code you had mentioned above to paste in the file /html/com_k2/default/item.php


However this is the only path where i found an item.php . Would the file in there be the correct one to edit?

/home/jags/www/templates/gk_game_magazine/html/com_k2/templates/default
User avatar
Senior Boarder

teitbite
Fri Mar 14, 2014 11:59 pm
Hi

Yes that's the exact file. Sorry for the mistake with lacking of /template folder in path. It's not neccessary, but it's working as well if this folder is used or not, that's why I always forget.
User avatar
Moderator

GK User
Mon Mar 17, 2014 1:10 pm
So when i did edit the file by adding the following code

<?php !empty($this->item->image): ?>
<script type="text/javascript">(function($) {$(document).ready(function() {
<meta property="og:image" content="<?php echo $this->item->image; ?>" />
});})(jQuery)</script>
<?php endif; ?>

at the top of the file(before the original code starts)

the website loads but when i click any article it just gievs a blank page. no error or anything. Nothing loads up.
User avatar
Senior Boarder

teitbite
Mon Mar 17, 2014 10:23 pm
Hi

This means that there must be an error in syntax. Please send me an access to ftp so I'll check it.
User avatar
Moderator

GK User
Sat Mar 22, 2014 6:46 am
Hi

I sent you FTP access via private message some time ago. Any luck?
User avatar
Senior Boarder

teitbite
Sun Mar 23, 2014 6:39 pm
Hi

Sorry. I must have oppened Your PM by accident, becuase it was marked as read, but have not entered any data to my ftp client. I've tried just now, but it doesn;t work. Anyway today I had same question and user confirmed a correct solution: https://www.gavick.com/forums/rockwall- ... 21#p170021
User avatar
Moderator

teitbite
Mon Apr 14, 2014 9:54 am
Hi

Here is a fixed file which is working in my copy. There still may be one small problem wih adding "http://" or "https://" to image url, but I can't tell the right solution before seeing this file replaced in /html/com_k2/defult/item.php
User avatar
Moderator

GK User
Mon Apr 14, 2014 10:20 am
It seems to be working on some articles now.
User avatar
Senior Boarder

GK User
Mon Apr 14, 2014 10:22 am
I will see how it works with Newly created articles.

Should I use the article image option to upload a specified article image/select one that is already uploaded or do I leave it for article to selectr first image on its own?
User avatar
Senior Boarder

teitbite
Mon Apr 14, 2014 8:41 pm
Hi

My script selects K2 image and puts it inside og:image for facebook, so would be better to use it, but I think a text image will be selected by facebook. Anyway I'm just 80% sure of that.
User avatar
Moderator


cron