[SOLVED] Facebook Comments, wrong image in FB

Phoca Gallery - image gallery extension
PippoPippi
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 01 Dec 2012, 10:14

[SOLVED] Facebook Comments, wrong image in FB

Post 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 :x

My Joomla version is 1.5.25, Phocagallery version 2.8.1.

Pippo.
Last edited by PippoPippi on 06 Dec 2012, 11:36, edited 5 times in total.
PippoPippi
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 01 Dec 2012, 10:14

Re: Facebook Comments, wrong image in FB

Post 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 :x

What am I'm doing wong?
PippoPippi
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 01 Dec 2012, 10:14

Re: Facebook Comments, wrong image in FB

Post 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. :x :x :x :x :x
I surrender.
PippoPippi
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 01 Dec 2012, 10:14

Re: [@ Jan, Benno] Facebook Comments, wrong image in FB

Post by PippoPippi »

I dont' know the reason why but the tags <meta property> are not passed anymore to the page...
PippoPippi
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 01 Dec 2012, 10:14

Re: [@ Jan, Benno] Facebook Comments, wrong image in FB

Post 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 :|
Post Reply