Websnapr Field: a web thumbnail module for Drupal

Technology Blog

Websnapr Field is a little module I’ve written which uses the Websnapr service to generate web page thumbnails in a page. If you have a field which is a URL pointing to an external site, you can choose to display it as a snapshot of the page pointed to.

So instead of http://figure-w.co.uk/ your visitors might see this:

There’s an existing module which gives you snap previews, but my client wanted a regular image to be generated rather than one that appears only when you mouse over the URL.

It’s a work in progress rather than a finished item: it currently only provides the two small sizes of image which are generated by Websnapr’s free service, and its HTML output is perhaps a little limited, though theming overrides could be used to improve it in that respect. It’s not been tested as yet with Views. For now, it’s Drupal 6 only, though a backport to Drupal 5 would not be hard.

The module is very small: all the real work of validating and managing URLs is done by the Link module, while Websnapr Field simply provides a set of formatters (currently just two, one for each of the two image sizes) by which URLs can be displayed. You first create a URL field and choose the Link field type, then configure it to use Websnapr for display. For screenshots to work, you also have to enter your Websnapr key (as provided by Websnapr after registration) in a separate administration panel.

Update: the Websnapr field module is now on Drupal.org.

12 Responses to “Websnapr Field: a web thumbnail module for Drupal”

  1. Glenn McLelland

    Yes publish it to Drupal.org. It would be a cool feature to use imache cache profiles for the thumbnail size and you could possibly store in image in an imagefield.

  2. Alfred Armstrong

    Glenn, thanks for the encouragement though there may be some technical difficulties in what you suggest. I seem to recall that copying images from an external source is tricky in PHP, though I may be mistaken.

  3. Nick

    This is definitely worthy of being committed to d.o
    downloading now to have a squizz

  4. Matt

    Thanks for creating that. Works like a charm. One request — how about adding an option to open the link in a separate window, as supported by the underlying Link field option?

  5. wojtek

    Is there any way to add rel=nofollow to those thumbnails? the one from link module doesn’t work

  6. bart

    that rocks. awesome. tu.

    wojtek – u can use nofollowlist module which generally allow you to make whitelist of site you will to follow. if you not add any site then all links are nofollow. althought i’m not sure what ’bout internal links.

    p.s. i’m from poland too. pozdrowienia dla polaków ! 🙂

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>