WordPress.org

Ready to get started?Download WordPress

Forums

facebook-error: "og:image too small" even if its not (2 posts)

  1. Yuliyah
    Member
    Posted 5 months ago #

    I have some problems with facebooks open graph and I have no idea what might cause them. I use 'All in One SEO Plugin' to create the open graph meta information, which it does correctly.

    See this post: http://y2b-blog.de/2014/so-war-dancing-dreams-2014-das-sagt-ihr/

    When you look at the source you see that the attached og:image is http://y2b-blog.de/wp-content/uploads/2014/01/Dancing-Dreams-Poster.jpg
    which is a 564x800 px image. It is also referenced here as og:image https://graph.facebook.com/706205779446106

    But when I try to post the link on fb, this image is not used. Plus, the facebook debugger tells me that the attached image is too small: http://y2b-blog.de/wp-content/uploads/2014/03/Bildschirmfoto-vom-2014-03-12-155940.png

    For some reason facebook uses a wrong 40x40px version of the image and I can't figure out why and where it takes it from.

    It would be really nice if somebody could have a look at this issue and tell me ideas how to solve it.

    Thanks a lot!

  2. Nimesh Rathod
    Member
    Posted 17 hours ago #

    I have the same issue.
    But even you may be try to put the given below code in your function.php file and than try, unfortunately it has been not work for me, may be it will work for you.

    function insert_image_src_rel_in_head()
    {
            global $post;
            if ( !is_singular()) //if it is not a post or a page
            return;
    
            if(!has_post_thumbnail( $post->ID ))
            {
                    //the post does not have featured image, use a default image
                    $default_image="http://example.com/image.jpg"; //replace this with a default image on your server or an image in your media library
                    echo '<meta property="og:image" content="' . $default_image . '"/>';
            }
            else
            {
                    $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
                    echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
            }
            echo "";
    }
    add_action( 'wp_head', 'insert_image_src_rel_in_head', 5 );

Reply

You must log in to post.

About this Topic