How does Facebook detect images when adding a link?

前端 未结 3 957
甜味超标
甜味超标 2021-01-14 14:28

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.

O

相关标签:
3条回答
  • 2021-01-14 14:58

    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="" />
    0 讨论(0)
  • 2021-01-14 15:06

    This looks like a duplicate of: Facebook Post Link Image

    Use <link rel="image_src" href="abs_url_of_your_image">
    
    0 讨论(0)
  • 2021-01-14 15:12

    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!

    0 讨论(0)
提交回复
热议问题