[Guide] Facebook Open Graph Images
Posted: 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
thise code
Then in components\com_phocagallery\views\comment\view.html.php
add after
this
Now you can share your categories or your images on Facebook with correct og:image.
I hope to be helpful.
Kemin
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 {
Code: Select all
if ($key<10) {
$this->document->addCustomTag('<meta property="og:image" content="http://www.SITENAME.EXT/images/phocagallery/'.$value->filename.'"/>');
}
add after
Code: Select all
$item->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($item->filenameno, 'large');
Code: Select all
$this->document->addCustomTag('<meta property="og:image" content="http://www.SITENAME.EXT/images/phocagallery/'.$item->filenameno.'"/>');
I hope to be helpful.
Kemin