Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: meta/link-rel tags  (Read 4922 times)

0 Members and 1 Guest are viewing this topic.

grantson

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 35
meta/link-rel tags
« 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
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

thanks

Grant



Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: meta/link-rel tags
« Reply #1 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. 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).
Logged

grantson

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 35
Re: meta/link-rel tags
« Reply #2 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: meta/link-rel tags
« Reply #3 on: June 17, 2010, 05:17:38 pm »

What exactly have you done so far?
Logged

grantson

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 35
Re: meta/link-rel tags
« Reply #4 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
Logged

grantson

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 35
Re: meta/link-rel tags
« Reply #5 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

Logged

grantson

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 35
Re: meta/link-rel tags
« Reply #6 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;


 
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.