Feeds Image Grabber (FIG) was released on 3rd March, and currently supports the following features:
- Automatically downloads and attaches image to the node created by Feeds module.
- Configurable XPath of the desired image location on the webpage of the feed item on per feed basis (using element’s id or CSS class).
- Support for FileField Paths module.
- Configurable maximum image size.
- Configurable minimum and maximum image resolutions.
In this post, I will briefly demonstrate how to configure the settings for FIG to efficiently grab images for feed items.
Image Field Settings:
Feeds module will create nodes from feed-items of content type as chosen in the FeedsNodeProcessor settings. FIG will store the image grabbed in an image field attached to the node of this content type. Therefore, you must add an image field to this content type. For example, if the content type of feed-items is story, you need to go to admin > content types > story > manage fields and add a field of type File and widget Image. (http://drupal.org/node/609628)
Configure the settings of the image field, such as extensions, minimum and maximum resolution, maximum size, etc. While grabbing the image, FIG will automatically take into consideration the settings of the image field to which the downloaded image will be mapped.
Mapping Settings:
Now, you must go to the mapping settings for the Node Processor of the Feed Importer and map Item URL (Link) to one of the available imagefields which are appended by “(FIG)“.
Feeds Image Grabber Settings:
After enabling FIG and configuring the above settings, you will see the following additional form whenever you create or edit a feed.
Here is a brief explanation of the available fields:
- Enable Feeds Image Grabber: As the description says, check this box if you want FIG to download images of the feed items created by this feed.
- Search for an image between the tag identified by: It has been explained before.
- Feeling Lucky: FIG will select the first image between the tag if the “yes” is selected, else will search for all the images to find the largest image between the tag.
- Execution time: FIG will take the selected percentage of maximum PHP execution time to grab image for each feed item. If images are not grabbed for some feed, try increasing this percentage to decrease errors due to network timeouts.
That is all. Once you click on import, you will get the feed item nodes along with the images. If images are not grabbed, here is a list of possible reasons,
- Timeout, try increasing the Execution time.
- Malformed HTML source.
- Validation failures (due to maximum size, minimum resolution, etc).
I am working on better error logging and reporting, so that you can know the reasons for sure.