Keyword

Facebook Share returning Blank Thumbnail

  • Goh Yew Hoe
  • Goh Yew Hoe's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 10 months ago #100964 by Goh Yew Hoe
Facebook Share returning Blank Thumbnail was created by Goh Yew Hoe
I can't seems to get the thumbnail to display when I share my articles onto facebook. With the debugging tool, I see that facebook is able to find my image and it's url but it display it as a blank?

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.

More
12 years 10 months ago #100965 by Lefteris
Replied by Lefteris on topic Re: Facebook Share returning Blank Thumbnail
Hi. It seems that Facebook did some changes and now it uses the open graph meta tag (<meta name="og:image" content="XXX" />) instead of the image tag. The best way to do this is find a plugin since Facebook requires also other open graph tags.

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

  • Goh Yew Hoe
  • Goh Yew Hoe's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 10 months ago - 12 years 10 months ago #100966 by Goh Yew Hoe
Replied by Goh Yew Hoe on topic Re: Facebook Share returning Blank Thumbnail
I have a plugin that handles the opengraph however it doesn't work very well for the image. The og image tag will only be detected properly if I insert the image into full text of the article thru the editor. It doesn't work if I just use the intro image given to K2.

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.

More
12 years 10 months ago #100967 by Lefteris
Replied by Lefteris on topic Re: Facebook Share returning Blank Thumbnail
Facebook requires much more tags than just the og:image. So adding just this is not a solution. URLs will still get errors by the Facebook debugger tools. That's why i suggested seperate plugin for this. You can however do this in your template overrides:
$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
  • Goh Yew Hoe's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 10 months ago #100968 by Goh Yew Hoe
Replied by Goh Yew Hoe on topic Re: Facebook Share returning Blank Thumbnail
I added the code you suggested to item.php with template overwrite and see this added attribute from the scrape url now.
Log in  or Create an account to join the conversation.

  • Goh Yew Hoe
  • Goh Yew Hoe's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 10 months ago #100969 by Goh Yew Hoe
Replied by Goh Yew Hoe on topic Re: Facebook Share returning Blank Thumbnail
After some very tedious Google search, I found an old topic that contains a solution code by one of the users here. Topic Link
Log in  or Create an account to join the conversation.

  • Kannan Naidu Venugopal
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
12 years 10 months ago #100970 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Facebook Share returning Blank Thumbnail
I'm using this for now and works like a charm too :D. Thanks Lefteris Kavadas for the facebook image code.

					
K2 Rocks \m/

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

More
12 years 9 months ago #100971 by Darko Petkovski
Replied by Darko Petkovski on topic Re: Facebook Share returning Blank Thumbnail

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
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
12 years 9 months ago #100972 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Facebook Share returning Blank Thumbnail
Create template override and add this in item.php

K2 Rocks \m/

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

More
12 years 8 months ago #100973 by Lul Blaka
Replied by Lul Blaka on topic Re: Facebook Share returning Blank Thumbnail
I really don't understand where to put this code ,,,
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.

More
12 years 8 months ago #100974 by Lefteris

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

More
12 years 8 months ago #100975 by George Savvoglou
Replied by George Savvoglou on topic Re: Facebook Share returning Blank Thumbnail
A think this code works!!!

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.

More
12 years 8 months ago #100976 by Lefteris
Replied by Lefteris on topic Re: Facebook Share returning Blank Thumbnail
@George Savvoglou

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.

More
12 years 7 months ago #100977 by nodun
I have similar issue but describen steps are not working for me.

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.

More
12 years 7 months ago #100978 by Lefteris
Replied by Lefteris on topic Re: Facebook Share returning Blank Thumbnail
@nodun

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.

More
12 years 7 months ago #100979 by Lul Blaka
Replied by Lul Blaka on topic Re: Facebook Share returning Blank Thumbnail
i have readed the documents,,, and then overided the files, as the manual said

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
  • Goh Yew Hoe's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 7 months ago - 12 years 7 months ago #100980 by Goh Yew Hoe
Replied by Goh Yew Hoe on topic Re: Facebook Share returning Blank Thumbnail
Hmm.. depending on your template the file could be in a different folder, but it should be something like com_k2\template_name\item.php You can put the code near the top of the file, say after line 17.

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
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
12 years 7 months ago #100981 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Re: Facebook Share returning Blank Thumbnail
The path should be /templates/YOURJOOMLATEMPLATE/html/com_k2/

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
  • Goh Yew Hoe's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 7 months ago #100982 by Goh Yew Hoe
Replied by Goh Yew Hoe on topic Re: Facebook Share returning Blank Thumbnail
I just updated to 2.6.1 to test the OG support and it seems the og tags are defined wrongly.

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.

More
12 years 7 months ago #100983 by dilemtl
Replied by dilemtl on topic Re: Facebook Share returning Blank Thumbnail

Stephen wrote: in item.php

Log in  or Create an account to join the conversation.