Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Nov 2010
    Posts
    393
    Thanks
    48
    Thanked 1 Time in 1 Post

    Unhappy How to Add the Facebook 'Like' Button for Images on my Website Image Gallery?

    Hello,

    I have tried so many methods to try and implement the Facebook 'Like' button you see when you on a Fan Page's images on my websites image gallery to also show in the style you see whilst on Facebook and you hover over to see the buttons to 'Like', 'Comment' and 'Shared' amount.

    I have tried using the direct image URL, the pages URL and whatnot with the normal 'Like' button you can find on the developers.facebook.com side of Facebook, however, whenever you click on the button, it does not update the 'likes' on the Fan Page and it also doesn't load with the current 'likes'.

    I would be very grateful for some help or any advice and thank you in advanced!

    Best Regards,
    Tim
    Last edited by MrTIMarshall; 11-03-2012 at 02:07 PM.

  • #2
    New Coder
    Join Date
    Apr 2011
    Location
    California
    Posts
    54
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Go to Facebook help and find out a solution.
    App Developer, Front End Designer and Learner at>> Facebook App Development Company - Cygnis Media

  • #3
    Regular Coder
    Join Date
    Nov 2010
    Posts
    393
    Thanks
    48
    Thanked 1 Time in 1 Post
    I don't mean to appear to be rude, however do you not thing I have done so and if it was that easy, there wouldn't be almost 5,000 views and no advice so far.

  • #4
    New Coder
    Join Date
    Sep 2011
    Posts
    51
    Thanks
    2
    Thanked 15 Times in 14 Posts
    This solution has been working for others:
    Code:
    $('#likebutton').click(function(){
        $.ajax({
           type: 'POST',
           url: 'https://graph.facebook.com/OBJECT_ID/likes?method=POST&format=json&access_token=TOKEN,
           success: function(res) {
              // do something like style button
            }
        });
    });
    The reason why it doesn't work for you when you copy the URL it's because the actual "like" is sent by an AJAX request and it's not sent by just sending the user to a specific URL.

    I got the code example from this StackOverflow question: http://stackoverflow.com/questions/5...facebook-photo

  • The Following 2 Users Say Thank You to jimutt For This Useful Post:

    MrTIMarshall (11-24-2012), systems99 (11-27-2012)

  • #5
    New to the CF scene
    Join Date
    Nov 2012
    Location
    USA, Cincinnati
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Jimutt! The code you have provided here really works for me. I'm also having some problems with the facebook like button as well before. Thanks!

  • #6
    New Coder
    Join Date
    Nov 2012
    Location
    new york
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can use this code for face book like button.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body>
    <a target="_blank" href="http://www.facebook.com/dialog/feed?app_id=467220903300036&
    link= your url
    &picture= picture if you need
    &name=title of your post
    &description=drugstore.com offers Percentage off at Department Store. Save Up to 60% on Cuisinart Kitchen Cookware and Tools at Drugstore.com
    &redirect_uri=http://www.test.com/"><img src="http://www.test.com/fbpage/fb_share_button.png"></a>
    </body>
    </html>
    Last edited by Spookster; 11-28-2012 at 03:29 PM. Reason: just miss the closing tag


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •