Experimental project

This is a sandbox project, which contains experimental code for developer use only.

Generates thumbnails from the URLs in 'link' fields, and saves them in 'image' fields

Needs a proper, useful, name. Working title "phantomjs_capture_link" is meaningless to searchers.


This module allows you to connect a *link* field with an *image* field
and have the image field automatically populated with a screenshot
of the targeted URL.

The [phantomjs_capture](https://www.drupal.org/project/phantomjs_capture)
module already provides a sort of custom field datatype to do this,
but things will work better if we use standard link and image field
types, as they will be compatible with everyones expectations for
theming and data management.

## Usage

For use on a node or entity that has both a 'link' field and an 'image'
field.

With this module enabled, an extra **"PHANTOMJS CAPTURE"** option will be
available on 'link' field settings forms, as seen at
`/admin/structure/types/manage/{bundle}/fields/{link_field}`

This will allow you to chose your target image field.

Once this is configured, saving or updating content of this type
should generate the screenshot automatically.
The image field can then be styled in the usual way.

Images can be regenerated by deleting the old one -
a new one will replace it once saved.

## Caveats

It is probably best the designated image field is dedicated to just
this purpose, as manually adding images may interfere with the automation.

Not much error-handling is done by phantomjs_capture yet.
Entering invalid or troublesome URLs can cause network timeouts.
Not every website renders perfectly. During testing, youtube.com
refused to cooperate at all.
(Debugging revealed taht "SSL handshake failed")

More imporovements to the phantomjs_capture are possible.
It would be nice to be able to define a less-huge screensize,
for example.

## Enhancement

The first thing you will probably want to do, is to link the
screenshot to its URL.
This is not done by this module, as it can be done better by a number of dedicated formatters:

* I prefer [linked_field](https://www.drupal.org/project/linked_field) as it's suitable for many cases, though it does depend on both token and entity_api.
* [field_group_link](https://www.drupal.org/project/field_group_link) can also do this well, and is great for linking entire teaasers.
* [image_link_formatter](https://www.drupal.org/project/image_link_formatter) promises to be easier.

## Alternatives

Previous 'screenshot' and website thumbnailer modules have come and gone,
but it seems like they all rely on third party web services.

* https://www.drupal.org/project/shrinktheweb

## Requirements

This module builds upon [phantomjs_capture](https://www.drupal.org/project/phantomjs_capture)
which provides the basic API to invoke the PhantomJS Utility.

Importantly, you have to be able to host and run the phantomjs tool
on your server locally. Installing this requirements may not be not an
option for many hosting plans.

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • caution Maintenance fixes only
    Considered feature-complete by its maintainers.
  • Module categories: Content Display
  • Created by dman on , updated