views:

224

answers:

4

When you add a link to your Facebook page, after some processing, Facebook presents you a next/prev button to choose an image linked to the url your are inserting.

Obviously, Facebook reads the html-page and displays the images found on the url you insert.

Does anyone knows what algorithm Facebook uses to decide what images to show ?

If I insert a link to : http://www.staplijst.be/lachende-wandelaars-aalter-aktivia-003.asp, only 11 images are detected. The one I want, the one at the top right corner, is not included in the list.

If I insert a link to http://www.staplijst.be/stichting-kennedymars-rijsbergen-zundert-nederland-knblo-nl-81996.asp, 19 images are displayed (including the one I want (the one at the right top corner of the text area).

Both pages are build using asp code but are functionally the same.

I thought that it has something to do with the image size, but can't find any deciding factor there.

I will investigate some furhter, because if I know what Facebook is looking for, I can make sure that the correct images are included on the page (since they are dynamic pages build with classic asp).

But if anyone has any idea ? Help would be appreciated.

A: 

I am not familiar with the way Facebook did it, but I can tell you how I would do it.

  1. Establish web request to desired url
  2. Parse resulted web response with regular expression, that looks for <img src="" />
Boris Modylevsky
@Borid Modylevsky: Yes I know how I would do it to. But obviously Facebook is doing something else :)
Edelcom
I think it uses some kind of heuristic to determine which images to show. I am not sure but compare the images on the two pages to find out whats common.
Salman A
I always assumed it had looked for the biggest image in the page, but sounds like it is more complicated than that.
rikh
@rikh: Yes it's more complicated. If you look at the two pages, both are functionally the same (with the same small images at the right of the page). The only difference is the 'main' text area (with the logo at the top) and with a table if data is present in the database. The same pictures which are not used by FB when using the first page, ARE displayed by FB when inserting the second page. So it has nothting to do with image size or image position, so I am at a loss at the moment.
Edelcom
@Salman A: Did that, the images are exactly the same (except when displaying the additional logo image in the 'main' text area).
Edelcom
Could it be trying to detect the "main content area" of the page by looking for divs with id like "content" etc, or discarding areas described as menus, nav, headers, footers etc. Then picking the first or biggest image in the content part of the page.
rikh
@rikh: Maybe, but the two pages are functionally the same, so if it should discard something like nav, headers and the like, it should do it on both pages. I find it strange ...
Edelcom
A: 

My guess, is that FB hides repeated images - 'couse a repeated image normally indicates a design-element (not content). When you post a link, only images related to that articles content, are relevant.

So; make sure your image only appears once, and see if it helps!

qualbeen
@qualbeen: I also thought in that direction. But the two pages are basically the same. What's more, the page that works has the main image repeated more than once, while the page that doesn't work has the main image only once in the text area.
Edelcom
+1  A: 

This looks like a duplicate of: http://stackoverflow.com/questions/1079599/facebook-post-link-image

Use <link rel="image_src" href="abs_url_of_your_image">
thomask
@thomask: Thanks for pointing this out. Had looked for a similar question before asking mine, but used the wrong words to search for (obviously). I will try the technique mentioned there and let you know the result).
Edelcom
Waiting patiently on results and acceptance :)
thomask
@thomask Accepted, cause you were the first to point out the rel="iamge_src", thx.
Edelcom
+1  A: 

Just found this, that Facebook publishes to show how to get a specific image / video etc to appear in the thumbnail...

http://wiki.developers.facebook.com/index.php/Facebook_Share/Specifying_Meta_Tags

rikh