How to share images on facebook and twitter | Community
Skip to main content
Level 3
June 30, 2016
Solved

How to share images on facebook and twitter

  • June 30, 2016
  • 2 replies
  • 1197 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

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

2 replies

AnkurAhlawat-1
Level 6
July 1, 2016

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

kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
July 1, 2016

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