From the Labs: SmartImage (Contextual images for your site)

What is it?

SmartImage is an easy way to deliver images to your web site or blog.

You can use this to bring content to all of the pages in your catalog. For example, try adding it to the template file of your blog.

How Does it Work?

There are two ways to include images. The most flexible way is to include a small script on your page, shown below. The first time your page is viewed, we will scrape the content, and identify a recent photo in the news that is appropriate.

This produces a photo of Barack Obama, since he is mentioned twice on this page:


You can also specify a query or name instead of having us scrape your page, by supplying a "query" parameter to the script:

Which produces the following photo:


If we're having trouble scraping your page, for example pulling in unrelated header or footer material, or link lists, you can specify the part of the page you want us to use for image matching by using HTML comments as shown below:


Another aspect you can control is the width of the image. You can specify any width from 105 pixels to 240. If you go larger than 105 pixels, note that the catalog of images we can serve to you becomes somewhat smaller, depending on licensing. For example, a 240 width photo for John McCain:

Which produces the following photo:


We also have a much simpler JPEG smart image. You just include http://labs.daylife.com/simg/smartImage.jpg on your page, and we do the rest. This has the advantage of not requiring scripts, and it can go places that scripts can't go. The same query and scrape indicators can be used, however width control is not available. For example:

Produces a scrape-based photo of Obama:


While this one uses a parameter to pull a photo using the query parameter: