Page 1 of 1
[SOLVED] Facebook Comments, wrong image in FB
Posted: 01 Dec 2012, 11:07
by PippoPippi
Hello everybody!
This is my problem: when I comment an image with Facebook Comments in my FB page doesn't appear the right image thumbnail but another image
My Joomla version is 1.5.25, Phocagallery version 2.8.1.
Pippo.
Re: Facebook Comments, wrong image in FB
Posted: 01 Dec 2012, 16:08
by PippoPippi
Ok, I've read this post:
viewtopic.php?f=32&t=13463#p54689
so I've added after DOCTYPE:
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://ogp.me/ns#"
xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
in
mytemplate/index.php
then in
/components/com_phocagallery/views/comment/view.html.php
I've added after the lines:
Code: Select all
// ASIGN
$this->assignRef( 'tmpl', $tmpl );
$this->assignRef( 'commentitem',$commentItem);
parent::display($tpl);
the code:
Code: Select all
// ADD FACEBOOK META PROPERTIES
$document->addCustomTag('<meta property="og:image" content="http://'.$_SERVER['HTTP_HOST'].'/'.$item->linkthumbnailpath.'"/>');
$document->addCustomTag('<meta property="og:type" content="article"/>');
$document->addCustomTag('<meta property="fb:app_id" content="'.$tmpl['fb_comment_app_id'].'"/>');
The problem is that these meta properties are not included in the html
What am I'm doing wong?
Re: Facebook Comments, wrong image in FB
Posted: 01 Dec 2012, 17:17
by PippoPippi
Instead of:
Code: Select all
$document->addCustomTag('<meta property="og:image" content="http://'.$_SERVER['HTTP_HOST'].'/'.$item->linkthumbnailpath.'"/>');
$document->addCustomTag('<meta property="og:type" content="article"/>');
$document->addCustomTag('<meta property="fb:app_id" content="'.$tmpl['fb_comment_app_id'].'"/>');
I've added:
Code: Select all
$document =& JFactory::getDocument();
$document->addCustomTag( '<meta property="og:image" content="'.JURI::base().$item->linkthumbnailpath.'"/><meta property="og:type" content="article"/><meta property="fb:app_id" content="'.$tmpl['fb_comment_app_id'].'"/>' );
It worked for a pair of times, now it doesn'w work at all.
I surrender.
Re: [@ Jan, Benno] Facebook Comments, wrong image in FB
Posted: 02 Dec 2012, 10:04
by PippoPippi
I dont' know the reason why but the tags <meta property> are not passed anymore to the page...
Re: [@ Jan, Benno] Facebook Comments, wrong image in FB
Posted: 02 Dec 2012, 15:58
by PippoPippi
It seems it works now, just added the lines
Code: Select all
$document =& JFactory::getDocument();
$document->addCustomTag('<meta property="og:type" content="article"/>');
$document->addCustomTag('<meta property="fb:app_id" content="'.$tmpl['fb_comment_app_id'].'"/>');
$document->addCustomTag('<meta property="og:image" content="http://'.$_SERVER['HTTP_HOST'].'/'.$item->linkthumbnailpath.'"/>');
after the line
Code: Select all
$item->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($item->filenameno, 'large');
I hope it will work definively
