coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: MaPzel on May 11, 2012, 03:49:04 PM

Title: Custom Facebook like button
Post by: MaPzel 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:

   <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

Title: Re: Custom Facebook like button
Post by: Αndré on May 11, 2012, 04:50:14 PM
Have you already tried out that plugin: http://forum.coppermine-gallery.net/index.php/topic,70221.0.html
Title: Re: Custom Facebook like button
Post by: MaPzel 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?
Title: Re: Custom Facebook like button
Post by: Αndré on May 15, 2012, 01:52:16 PM
That depends on where you added your mod. Please post the whole function.
Title: Re: Custom Facebook like button
Post by: MaPzel 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.


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


?>

Title: Re: Custom Facebook like button
Post by: Αndré 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.
Title: Re: Custom Facebook like button
Post by: MaPzel 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.
Title: Re: Custom Facebook like button
Post by: Αndré 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).