Funnelback logo

Documentation

CATEGORY

Presenting Images

Introduction

Funnelback includes several tools for assisting in the presentation of images within search results, which are detailed below.

Resizing images

Images available for presentation within search results are often sized inconsistently, making it difficult to create a consistent result presentation. To assist with this problem Funnelback includes tools for easily resizing and cropping images to a desired size.

Funnelback's scale tool is presented simply as a URL which will return an appropriately transformed image based on a set of parameters. The tool is available at the following URL in the modern UI.

http://search-server.example.com/s/scale

The following parameters must be provided:

url
The URL of the source image. This may be created based on the URL of the search result, extracted from metadata, or determined in any other way as required.
width
The desired width of the resulting image.
height
The desired height of the resulting image.

The following additional parameters may be provided:

format
The image format to be produced. png images are produced by default, other supported values are jpeg and gif.

Scaling Type

Several scaling methods are supported. Available options are listed below.

type=keep_aspect
Retain the image's aspect ratio and treat width and height as maximum rather than exact values.
type=ignore_aspect
Resize the image to the exact size specified by width and height, even if it must be stretched/squashed to do so.
type=crop_(vertical)_(horizontal)
Crop the image, retaining only one section of the image to ensure the image does not need to be stretched. (vertical) and (horizontal) determine which part of the image to retain. Possible values: crop_top_left, crop_top_center, crop_top_right, crop_center_left, crop_center, crop_center_right, crop_bottom_left, crop_bottom_center, crop_bottom_right

Example Usage of Image Scaling

<img src="http://search-server.example.com/s/scale?url=http://www.funnelback.com/logo.jpg

&width=80&height=60&format=png&type=keep_aspect" alt="Thumbnail of Funnelback Logo" />

Restricting permitted image URLs

A search administrator may wish to ensure only certain images are processed by Funnelback. To do so a setting is available in the global.cfg configuration file.

default_image_fetcher.permitted_url_pattern=.*

This setting may be changed to any regular expression, and only URLs which match the given expression will be processed by Funnelback.

Rendering image previews of web pages

In multi-domain search services it is useful to present a preview of the web page behind each search result to allow users to visually recognise sites. To allow this, Funnelback provides a system for rendering previews of web pages which can be presented alongside search results.

Funnelback's URL preview tool is presented simply as a URL which will return an image preview of a given web page URL based on a set of parameters. The tool is available at the following URL in the modern UI:

http://search-server.example.com/s/preview

The following parameters must be provided:

url
The URL of the web page to preview. This would normally be the URL of the current search result, but may be any other HTML page as required. Note that only web pages (and not binary documents such as Word or PDF documents) are supported.
width
The desired width of the resulting preview.
height
The desired height of the resulting preview.

The following parameters may be provided:

format
The image format to be produced. png images are produced by default, other supported values are jpeg and gif.
render_width
Sets the width of the web browser window to render with before scaling to width (defaults to 1024 pixels).
render_height
Sets the height of the web browser window to render with before scaling to height (defaults to 768 pixels).

Scaling Options

The scaling options described in the image scaling section above are also supported.

Example Image Preview Usage

<img src="http://search-server.example.com/s/preview?url=http://www.funnelback.com&width=80

&height=60&render_width=1024&render_height=768&type=keep_aspect" alt="Thumbnail of Funnelback Homepage" />

Restricting permitted web page URLs

A search administrator may wish to ensure only certain URLs are processed by Funnelback. To do so a setting is available in the global.cfg configuration file.

default_url_renderer.permitted_url_pattern=.*

This setting may be changed to any regular expression, and only URLs which match the given expression will be processed by Funnelback.

Clearing caches

Funnelback automatically caches copies of scaled images and URL preview images to avoid the need to process them repeatedly. When the underlying image is changed, the cache must be cleared to cause the new version of the image to be displayed.

The cache can be cleared either for a specific scaled image or for all scaled images with the following requests:

# Clear cached image for the given URL and scaling settings
http://search-server.example.com/s/scale/clear-cache?url=URL&width=##&height=##
# Clear all cached images
http://search-server.example.com/s/scale/clear-all-cache

Avoiding image processing during search queries

Funnelback automatically caches copies of scaled images and URL preview images to avoid the need to process them repeatedly, however the first request for a given image will take some time and add load to the search server, slowing other operations. If desired, images may be created during the collection update by fetching and storing them in a filtering step, then directing users to these stored copies rather than accessing the scale/preview URLs directly.

See Groovy Filters for further details on creating additional filtering steps.

top ⇑