-1

I would like to know how I detect a image from a webpage. I want a code that if I want to share something on facebook the image from the page where I am at that time, automatically detect.

example:

<meta property="og:image" content="http://www.geturl.thedoctorofhouse.com/audi_a3_2.jpg" />

What should I do with the og:image content?

1 Answers1

0

Yes, that looks correct - content should contain the url to the image that you want used.

You can check how the page metadata is interpreted by using the linter tool provided by Facebook

Joe T
  • 794
  • 4
  • 6
  • No i want to get a random image from the page where i am...? The image http://www.geturl.thedoctorofhouse.com/audi_a3_2.jpg is not the image that i wanted to have. – Jeffrey van der Zalm Aug 31 '12 at 12:06
  • So this is not a programming question at all? Chose another image, if Facebook offers more than one – or chose to display the link without any image. That’s about it, when it comes to sharing content that is not yours on Facebook. – CBroe Aug 31 '12 at 13:00
  • @CBroe I want to select the image(s) that is on the webpage, maybe with a $_GET variabe? I'm not very good with php. – Jeffrey van der Zalm Aug 31 '12 at 13:35
  • @CBroe something like this: $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; echo $url; – Jeffrey van der Zalm Aug 31 '12 at 13:38