WordPress.org

Ready to get started?Download WordPress

Forums

Simple Facebook Connect
Bug in the way Like and Share plugins handle images (4 posts)

  1. Jen Montes
    Member
    Posted 3 years ago #

    I've been having trouble with the thumbnails on the Share previews of some of my articles: articles with assigned post thumbnails didn't show a thumbnail in the Share preview, but articles that didn't have a thumbnail assigned worked just fine.

    After looking around in the plugin I noticed that for images that have an assigned post thumbnail, the sfc-like.php and sfc-share.php both grab the image like this:

    $att = wp_get_attachment_image_src($thumbid, 'full');

    I'm thinking that this might be causing me problems because my full-sized images are huge and the Facebook code just decides to quit after a while. So I changed the line above to this in both files:

    $att = wp_get_attachment_image_src($thumbid, 'thumbnail');

    And now my thumbnails work fine! If you think thumbnail is too extreme, I think medium would work too.

    Also, there's another bug in the sfc-like.php code that I wanted to point out... After grabbing the assigned post thumbnail, the code inserts it into the header like this:

    <link rel="image_src" href="<?php echo $att[0]; ?>" />

    When I think you actually meant to do this:

    <meta property="og:image" content="<?php echo $att[0]; ?>" />

    Why am I posting here if I already solved my problem? The truth is that I love this plugin and I'd like to see these fixes integrated so that I don't have to keep hacking at it whenever there's a plugin update.

    Cheers!

    http://wordpress.org/extend/plugins/simple-facebook-connect/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 3 years ago #

    I use the full size because Facebook resizes the image themselves. If your full sized images are too big, then maybe you should resize them before uploading. The plugin can't use anything but full because only the full image is guaranteed to be there. Not everybody does resizing. Not every image gets resized.

    And yes, that code in like is slightly off there. It was copied from the share, which uses the image_src link tag.

  3. Derek Perkins
    Member
    Posted 3 years ago #

    Otto - Even if the original uploaded image is a lower resolution than the large or other image settings, you should still have an image returned. It doesn't quite make sense to have to resize original images for the sake of Facebook when one of the other image sizes should serve just as well.

  4. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 3 years ago #

    I'll switch it to use 'large' for those, but that's as far as I'm willing to go with it. It doesn't make any sense to me to send Facebook a lower quality image when you have a higher quality one available. And sending them the thumbnail is just weird, especially since the thumbnail in a lot of setups is a cropped image.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic