coder1.com

  • home
  • drupal articles
  • contact
Home

Controlling the Image Choice When Sharing with Facebook

Mike Milano — November 10, 2011 - 5:40am

Recently I had a client who wasn't happy with the images Facebook was providing as options when a user shared one of their product pages with Facebook.

You can give Facebook hints on what images you would like them to use.

Just add this code to your page for the images you would like to be in the selection:

<link rel="image_src" type="image/jpeg" href="http://example.com/images/my-image.jpg"/>

In my case, the image I defined here was the first choice that appeared on Facebook.

You can define more than one image for the available options.

Keep in mind when you are testing that Facebook caches the images for the link you are providing, so, if you make changes, they may not show up immediately unless you use a fresh URL to share.

  • Facebook

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <img> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3> <h4> <h5> <h6> <h7>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].

More information about formatting options

Poll

Have you used any NoSQL Databases?:

User login

  • Request new password

Navigation

  • Recent posts

  • home
  • drupal articles
  • contact