-2

I shared a image as facebook post using below code:

$linkkk=https://example.com/edited/image.png. 

$shareUrl='https://www.facebook.com/dialog/feed?app_id=***********&display=popup&caption=testing&link='.$linkkk;

But when I clicked on the image post I shared on facebook it shows the image in new tab. But, I want to redirect it to new(custom) url when someone clicks on post.

How it can be done?

Any help on this is appreciated. Thanks in advance.

Parashuram
  • 303
  • 2
  • 6
  • 19
  • It can’t, not if you are sharing an image URL directly. Share a link to an HTML document that has the image set as thumbnail, then users will go there when they click. – 04FS Jan 30 '19 at 08:42

1 Answers1

0

Share your custom URL instead, including the image as og:image tag.

More information about og tags: https://developers.facebook.com/docs/sharing/webmasters/

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • Thanks for reply. I have read the link you shared. As per my understanding og:image can be set to one page(e.g for a html). In my case is it passible to set og:image tag to my url('https://www.facebook.com/dialog/feed?app_id=***********&display=popup&caption=testing&link='.$linkkk). Because every url is new url because generated image name in share url unique for my website. – Parashuram Jan 30 '19 at 09:19
  • you have to use a separate unique url with the correct og:image then. – andyrandy Jan 30 '19 at 09:21