Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Custom Facebook like button  (Read 4649 times)

0 Members and 1 Guest are viewing this topic.

MaPzel

  • Coppermine newbie
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 8
    • TWV Hengelo.com
Custom Facebook like button
« on: May 11, 2012, 03:49:04 pm »

I've added a like button in displayimage.php by adding the standard FB html code between the PHP code of Copppermine. It now looks like this:

Code: [Select]
   <html>
      <div id="fb-root"></div>
      <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));</script>
      <center>
      <div class="fb-like" data-href="<?PHP ECHO "$picture_url" ?>" data-send="false" data-width="500" data-show-faces="true"></div>
      </center>
      <br />
      </html>

As link I used the tag
Code: [Select]
$picture_url. But this generates the Coppermine url to display this image. I'd like to see that the like button would return the link to the image itself. Is there a 'tag' available for the image location?

Example: http://www.twvhengelo.com/fotoalbum/displayimage.php?album=355&pos=0

-> I'd like on this page to let the 'like button' to return the url: http://www.twvhengelo.com/fotoalbum/albums/12-04-15%20Testdag%20TWV/P1040484.JPG

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Custom Facebook like button
« Reply #1 on: May 11, 2012, 04:50:14 pm »

Logged

MaPzel

  • Coppermine newbie
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 8
    • TWV Hengelo.com
Re: Custom Facebook like button
« Reply #2 on: May 15, 2012, 01:10:55 pm »

yes I did try this plugin. But this one does exactly the same as my 'like button' now does. It places the direct link to the page in Coppermine where the picture is show via the Picture ID as declared in the database.

I'd like my button to share the direct link to the *.jpg file of the picture/photo on the webserver. So I'm looking for the $***** which declares the location of the current picture shown. Is there such a tag used within the coding of Coppermine?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Custom Facebook like button
« Reply #3 on: May 15, 2012, 01:52:16 pm »

That depends on where you added your mod. Please post the whole function.
Logged

MaPzel

  • Coppermine newbie
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 8
    • TWV Hengelo.com
Re: Custom Facebook like button
« Reply #4 on: May 15, 2012, 01:58:01 pm »

The mod is at the end of displayimage.php so that the 'like button' is shown under the picture cell.


Code: [Select]
    // Display Filmstrip if the album is not search
    if ($album != 'search') {
        $film_strip = display_film_strip($album, (isset($cat) ? $cat : 0), $pos, true);
    }
    CPGPluginAPI::filter('post_breadcrumb',null);
    theme_display_image($nav_menu, $picture, $votes, $pic_info);
   
   
 ?>
 
     <html>
      <div id="fb-root"></div>
      <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));</script>
      <center>
      <div class="fb-like" data-href="<?PHP ECHO "$filename" ?>" data-send="false" data-width="500" data-show-faces="true"></div>
      </center>
      <br />
      </html>
     
 <?PHP
 
    theme_display_image($comments);
    pagefooter();
    ob_end_flush();
}


?>
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Custom Facebook like button
« Reply #5 on: May 15, 2012, 02:28:52 pm »

Sorry but that's probably the worst place to add that code. I suggest to use and adjust the plugin instead of your mod.
Logged

MaPzel

  • Coppermine newbie
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 8
    • TWV Hengelo.com
Re: Custom Facebook like button
« Reply #6 on: May 15, 2012, 04:03:32 pm »

Oke that's a bummer.. Which php file should otherwise be modded when I would add a code like I used here? I thought that 'displayimage.php' was the only file where it is possible to add the mod on the right place and only while showing a picture.

But still when I would choose to mod the FB plugin I would like to know where and in which .php file the picture location is declared.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Custom Facebook like button
« Reply #7 on: May 15, 2012, 04:33:38 pm »

Please ask your question in the plugin's announcement thread. It's probably something other people would like to have, too (if it hasn't already been discussed in that thread - I don't know).
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.