Custom Facebook like button Custom Facebook like button
 

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]

Main Menu

Custom Facebook like button

Started by MaPzel, May 11, 2012, 03:49:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MaPzel

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:

   <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 $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


Αndré


MaPzel

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?

Αndré

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

MaPzel

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


    // 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();
}


?>


Αndré

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

MaPzel

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.

Αndré

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).