Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to share images on facebook and twitter

Avatar

Level 3

Hi ,

I have a requirement to share images on Facebook & Twitter

I have Image Gallery Component where images are shown in rows and columns. There I click on Image on Modal pop up will come there I will have two buttons like : Facebook Share and Twitter.

If I click on Share it will redirect to facebook login page and after login I will be able to share an image on facebook.

and twitter I have to tweet an image from my website.

I am using AEM 6.1 version

Please help me how to share images on light box to facebook and other social media.

 

thank you in advance

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi

Working code for FB Sharing :- 

Demo1:-http://jsfiddle.net/eyxtj/345/

//here the impotent part is,

        var fb_title     = encodeURIComponent('my title goes here!');
        var fb_descr     = encodeURIComponent('my description goes here');
        var fb_url       = encodeURIComponent('www.adobe.com');
        var fb_image     = encodeURIComponent('http://www.highyieldbond.com/wp-content/uploads/2013/04/silver-apple-logo-apple-picture1.jpg');

 

Demo2:- https://jsfiddle.net/stichoza/eyxtj/

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

2 Replies

Avatar

Level 7

I have faced similar issue once. Have you tried going to

https://developers.facebook.com/tools/debug/og/object/

and pressing the button "Fetch New Scrape information". and after that try sharing the image. If you are using any caching mechanism. please clear cache first.

regards,

Ankur Ahlawat

AEM CQ5 Tutorials

Avatar

Correct answer by
Administrator

Hi

Working code for FB Sharing :- 

Demo1:-http://jsfiddle.net/eyxtj/345/

//here the impotent part is,

        var fb_title     = encodeURIComponent('my title goes here!');
        var fb_descr     = encodeURIComponent('my description goes here');
        var fb_url       = encodeURIComponent('www.adobe.com');
        var fb_image     = encodeURIComponent('http://www.highyieldbond.com/wp-content/uploads/2013/04/silver-apple-logo-apple-picture1.jpg');

 

Demo2:- https://jsfiddle.net/stichoza/eyxtj/

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni