- Posts: 39
COMMUNITY FORUM
Facebook Share returning Blank Thumbnail
- Goh Yew Hoe
-
Topic Author
- Offline
- Junior Member
Here's the link to try it with an article from my site.
Facebook Debugger Tool
As you can see under object properties, for OG Image, the thumbnail is blank but if you click on it. It actually links to the image in my article. The large version of the image.
However I understand that in K2 parameters, there is a place to define image size to share to facebook. Looking at the scrap data from facebook, I can find that meta tag which I define as extra small.
Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- Goh Yew Hoe
-
Topic Author
- Offline
- Junior Member
- Posts: 39
This creates a redundant step and also causes problem if using simple image gallery pro plugin because it will just return transparent.gif as placeholder for the gallery. I think the reason why facebook returns with a blank thumbnail at times is also because its trying to download the _L large image size which then timeout in the process, I'm not sure.
I think the simpler way atm would be perhaps to modify K2 source so that instead of saying
Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
$document = JFactory::getDocument();
$facebookImage = 'image'.$this->params->get('facebookImage','Small');
if($this->item->$facebookImage){
$document->setMetaData('og:image',substr(JURI::root(),0,-1).str_replace(JURI::root(true),'',$this->item->$facebookImage));
}
Please Log in or Create an account to join the conversation.
- Goh Yew Hoe
-
Topic Author
- Offline
- Junior Member
- Posts: 39
Log in or Create an account to join the conversation.
- Goh Yew Hoe
-
Topic Author
- Offline
- Junior Member
- Posts: 39
Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Darko Petkovski
-
- Offline
- New Member
- Posts: 10
Kannan Naidu wrote: I'm using this for now and works like a charm too :D. Thanks Lefteris Kavadas for the facebook image code.
Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Lul Blaka
-
- Offline
- New Member
- Posts: 2
i putted it in k2 template-default-item.php
but nothing is changed....
i still can not share my k2 items in facebook page
please someone assist...
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Have you read the documentation? Take a read at getk2.org/documentation/tutorials/item/174-templating-with-k2-and-the-concepts-of-sub-templates
Please Log in or Create an account to join the conversation.
- George Savvoglou
-
- Offline
- New Member
- Posts: 11
But the tumbnail at facebook is very small!! can i change this for a little bit bigger image?? :)
Kannan Naidu wrote: I'm using this for now and works like a charm too :D. Thanks Lefteris Kavadas for the facebook image code.
Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
If you have hardcoded the image then it depends on the image. Otherwise go to K2 paramters and select the desired width for the Facebook image.
Please Log in or Create an account to join the conversation.
- nodun
-
- Offline
- New Member
- Posts: 1
Somewhere in code my domain is doubling for og:image and generate code in single articles like:
<meta property="og:image" content="xtri.pl/http://xtri.pl/cache/multithumb_thumbs/b_500_450_16777215_00___images_Lunarglide4_DSC_0099.JPG">
you can check it on:
xtri.pl/sprzet/testy/item/243-test-nike-lunarglide4
Do you guys have any idea how to repair this issue?
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
We have added the og:image tag to K2 2.6 Beta version. So if you are using an earlier version the tag is not coming from K2. You need to search your templates and plugins for code that is generating.
Please Log in or Create an account to join the conversation.
- Lul Blaka
-
- Offline
- New Member
- Posts: 2
pls help me, where should i put the code, in which part of item,php,,, and which code exactely (because here I c many codes)
please someone help me share my k2 items on fb
Please Log in or Create an account to join the conversation.
- Goh Yew Hoe
-
Topic Author
- Offline
- Junior Member
- Posts: 39
Anyway, for anyone still looking to use this code, I have modified it to be as dynamic as possible so the field values are pulled from joomla instead of a static value. Note: Make sure you check the 2nd logo path though, it's picking logo.jpg from the root image folder but you can change it yourself to read from any folder or file.
<?php
$fbog =& JFactory::getDocument();
$app = JFactory::getApplication();
$facebookImage = 'image1'.$this->item->params->get('facebookImage','Small');
$opengraph_meta = '
<meta property="og:title" content="'.$this->item->title.'"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="'.substr(JURI::root(),0,-1).str_replace(JURI::root(true),'',$this->item->link).'"/>
<meta property="og:site_name" content="'.$app->getCfg( 'sitename' ).'"/>
';
if (!empty($this->item->$facebookImage)) {
$opengraph_meta .= '<meta property="og:image" content="'.substr(JURI::root(),0,-1).str_replace(JURI::root(true),'',$this->item->$facebookImage).'" />';
}
else {
$opengraph_meta .= '<meta property="og:image" content="'.substr(JURI::root(),0,-1).'/images/logo.jpg"/>';
}
$fbog->addCustomTag( $opengraph_meta );
?>
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
-
- Offline
- Platinum Member
- Aham Brahmasmi
It's better to upgrade to K2 2.6.x (latest version) as it already comes with OGP meta tags.
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Goh Yew Hoe
-
Topic Author
- Offline
- Junior Member
- Posts: 39
For example, it's defined as this at the moment.
<meta name="og:type" content="Article" />
That's wrong, it should be
<meta property="og:type" content="Article" />
So technically speaking, the og tags in K2 at the moment aren't working. Now to figure how to disable those faulty tags in K2...
Please Log in or Create an account to join the conversation.
- dilemtl
-
- Offline
- New Member
- Posts: 5
Stephen wrote: in item.php
Log in or Create an account to join the conversation.