forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: grantson on June 17, 2010, 02:38:22 pm

Title: meta/link-rel tags
Post by: grantson on June 17, 2010, 02:38:22 pm
Hi

I have been trying to integrate the facebook share button on my pages and have finally managed to get it to work
according to their docs i need to add a link-rel tag to get the image thumbnail when posted

i looked at this post http://forum.coppermine-gallery.net/index.php?topic=43650.0 (http://forum.coppermine-gallery.net/index.php?topic=43650.0)
but wasn't sure how to modify the solution in there to add the tag i need
which i believe is
Code: [Select]
<link rel="image_src" href="{$CONFIG['site_url']}{$CURRENT_PIC_DATA['url']}&{$CURRENT_PIC_DATA['title']}" />
I also tried to edit the description meta plug in to replace its injected meta tag on the image page but instead of getting the tag i get

/* <![CDATA[ */
    var js_vars = {"site_url":"http:\/\/www.magicmirrorphoto.co.uk\/gallery","debug":false,"icon_dir":"images\/icons\/","lang_close":"Close","icon_close_path":"images\/icons\/close.png","position":2,"album":1,"cat":false,"buttons":{"pic_info_title":"Display\/hide file information","pic_info_btn":"","slideshow_tgt":"displayimage.php?album=1&amp;pid=2&amp;slideshow=5000#top_display_media","slideshow_title":"Slideshow","slideshow_btn":"","loc":""},"stars_amount":"5","lang_rate_pic":"Rollover to rate this picture","rating":0,"theme_dir":"","can_vote":"false","form_token":"69bdcb7803234eabd27d95ed09ef7a3f","timestamp":1276776863,"thumb_width":"128","thumb_use":"any","max_item":"3","count":"3","picture_id":"2"};
/* ]]> */


can anyone point me in the right direction?

gallery is here http://www.magicmirrorphoto.co.uk/gallery (http://www.magicmirrorphoto.co.uk/gallery)

thanks

Grant



Title: Re: meta/link-rel tags
Post by: Αndré on June 17, 2010, 03:39:58 pm
I don't know what Facebook requires for their button to work. All we can support here are modifications of Coppermine.

We already had a similar topic in the German support board about a facebook button (http://forum.coppermine-gallery.net/index.php/topic,65292.0.html). Maybe that helps. If not, give as much information about the facebook stuff as you can (what data should you include to your website, what exactly should happen).
Title: Re: meta/link-rel tags
Post by: grantson on June 17, 2010, 04:30:17 pm
Hi Andre

German board is not much use to me im afraid, but thanks

i think mention of the facebook button is clouding the question slightly

basically i need to add this tag to the photo page
<link rel="image_src" href="thumbnail_image" / >
which needs to be generated dynamically and populated with the image data like so
<link rel="image_src" href="{$CONFIG['site_url']}{$CURRENT_PIC_DATA['url']}&{$CURRENT_PIC_DATA['title']}" />

but from the sources mentioned above i have been unable to get the tag to be injected correctly


Grant
Title: Re: meta/link-rel tags
Post by: Αndré on June 17, 2010, 05:17:38 pm
What exactly have you done so far?
Title: Re: meta/link-rel tags
Post by: grantson on June 17, 2010, 07:43:36 pm
1st search of the board found the plugin mentioned above,
I installed that looked to see what it did then looked at its sourcecode tried to figure out how it injects the metatag for the description & tried replacing the line where it forms the description metatag for the picture page with the line to form the one i need

this didnt work and where the meta tag was previously there the block of CDATA listed in the original post

i then found the thread linked above in the mods/hacks forum for description metas but couldnt figure out how the code was doing what it was doing to edit it
Title: Re: meta/link-rel tags
Post by: grantson on June 17, 2010, 08:53:05 pm
ahha finally after some strong coffee

i used ludo's mod from the link in the original post

OPEN
displayimage.php

FIND
Code: [Select]
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }

AFTER, ADD
Code: [Select]
if (!is_numeric($album)) $meta_fblink .= " - " . $album_name;
    $meta_fblink = "\n<link rel=\"image_src\" href=\"{$CONFIG['site_url']}{$CURRENT_PIC_DATA['url']}&{$CURRENT_PIC_DATA['title']}\" />\n";
    $meta_keywords .= $meta_fblink;

page source now has the meta tag
<link rel="image_src" href="http://www.magicmirrorphoto.co.uk/gallery/albums/userpics/10001/normal_IMG_0044_small.jpg>

only thing is now i realise the metatag needs to contain the link to the thumbnail as the main image is to big
oh well time to put the kettle on again  ;D

Title: Re: meta/link-rel tags
Post by: grantson on June 18, 2010, 01:39:18 am
done :)

the meta tag is now correct with the path to the thumbnail image
now have spotted a problem with my facebook button that still means it wont share properly but can hopefully get that sorted

for anyone else that needs it

FIND
Code:

Code: [Select]
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }

AFTER, ADD

Code: [Select]
// Add link-rel tag for facebook share button
if (!is_numeric($album)) $meta_fblink .= " - " . $album_name;
$thumb_url = str_replace('normal', 'thumb', $CURRENT_PIC_DATA['url']);
$meta_fblink = "\n<link rel=\"image_src\" href=\"{$CONFIG['site_url']}{$thumb_url}\" />\n";
$meta_keywords .= $meta_fblink;