[Guide] Facebook Open Graph Images

Before you ask see the Phoca Gallery User Manual
kemin
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 30 Nov 2012, 14:43

[Guide] Facebook Open Graph Images

Postby kemin » 16 Mar 2013, 13:35

Hi, these are my instructions to add tags og:image with the first 10 images of the category in categories view and the image in comments view.

In components\com_phocagallery\views\category\tmpl\default_images.php

Add after

Code: Select all

// IMG Start

            if ($extImage) {

               echo JHtml::_( 'image', $value->extm, $value->altvalue, array('width' => $correctImageRes['width'], 'height' => $correctImageRes['height'], 'class' => 'pg-image'));

            } else {

thise code

Code: Select all

if ($key<10) {
      $this->document->addCustomTag('<meta property="og:image" content="http://www.SITENAME.EXT/images/phocagallery/'.$value->filename.'"/>');
               }


Then in components\com_phocagallery\views\comment\view.html.php

add after

Code: Select all

$item->linkthumbnailpath   = PhocaGalleryImageFront::displayCategoryImageOrNoImage($item->filenameno, 'large');


this

Code: Select all

$this->document->addCustomTag('<meta property="og:image" content="http://www.SITENAME.EXT/images/phocagallery/'.$item->filenameno.'"/>');


Now you can share your categories or your images on Facebook with correct og:image.

I hope to be helpful.
Kemin


User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 36670
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: [Guide] Facebook Open Graph Images

Postby Jan » 21 Mar 2013, 01:07

Hi, thank you for this guide.

Jan
If you find Phoca extensions useful, please support the project

vedante
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 21 Aug 2013, 23:18
Location: Israel
Contact:

Re: [Guide] Facebook Open Graph Images

Postby vedante » 21 Aug 2013, 23:35

Hi! I have a problem when i use Picasa galleries.
on cooment view, when i post a coment - wrong thumbnail is displayed in facebook. :cry:
When i share the Url on facebook. It shows the right thumbnail.

Is the fact that i use Picasa galleries is matters?
If yes, what should be the code for right Picasa og:image ?

Thank you in advance!

(Also i want to thank the developer for greatest component for joomla ever!)

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 36670
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: [Guide] Facebook Open Graph Images

Postby Jan » 23 Aug 2013, 17:03

Hi, depends on used site, see if the comment has own page (not popup window) then it should be set this site :idea:

Jan
If you find Phoca extensions useful, please support the project

vedante
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 21 Aug 2013, 23:18
Location: Israel
Contact:

Re: [Guide] Facebook Open Graph Images

Postby vedante » 27 Aug 2013, 06:15

Hi! Thanks for the respons,
This is an examle for comment view of a picture on my site:
http://www.inoe.tv/galereya/220-best-pi ... -aviv2-jpg
Any help will be appriciated. (sorry for posting URL)

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 36670
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: [Guide] Facebook Open Graph Images

Postby Jan » 29 Aug 2013, 16:35

Hi, I see, the site is Ok, so then only idea is to ask facebook developers, why the post, etc. does not take the displayed image there :idea:
If you find Phoca extensions useful, please support the project


Return to “Phoca Gallery”

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests