FB.ui using share_open_graph method displays only small image

I have this code to create multiple generic buttons on the same page url, but with a custom title, description, and image.

    // this loads the Facebook API
    (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/sdk.js";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));

    window.fbAsyncInit = function () {
        var appId = '1937011929814387';
        FB.init({
            appId: appId,
            xfbml: true,
            version: 'v2.9'
        });
    };

    // FB Share with custom OG data.
    (function($) {

        $('.fb_share_btn').on('click', function (event) {
            event.preventDefault();
            event.stopPropagation();
            event.stopImmediatePropagation();

                // Dynamically gather and set the FB share data. 
                var FBDesc      = 'My custom description';
                var FBTitle     = 'My custom title';
                var FBLink      = 'http://example.com/my-page-link';
                var FBPic       = 'http://example.com/img/my-custom-image.jpg';

                // Open FB share popup
                FB.ui({
                    method: 'share_open_graph',
                    action_type: 'og.shares',
                    action_properties: JSON.stringify({
                        object: {
                            'og:url': FBLink,
                            'og:title': FBTitle,
                            'og:description': FBDesc,
                            'og:image': FBPic
                        }
                    })
                },
                function (response) {
                // Action after response
                })
        })

    })( jQuery );

      

For the image, I am following the "Sharing Best Practices" described here on the FB dev docs .

But when you share to Facebook, instead of displaying the image at a large size, for example:

enter image description here

It appears in a smaller version, for example:

enter image description here

I know the JavaScript SDK in JavaScript has recently overridden some of the options that were used to get this to work as I expect. So I switched to using the latest SDK (v2.9) and the method available for these custom sections using for common dialogs . share_open_graph

Does this mean that from SDK v2.9 + we can no longer have more sections displaying a larger image?

+3


source to share





All Articles