Avoid a fatal error if the filefield module is disabled after setting up imagecache...
[project/imagecache.git] / README.txt
CommitLineData
9d2e42c5
DP
1Imagecache is a dynamic image manipulation and cache tool. It allows you to
2create a namespace that corresponds to a set of image manipulation actions. It
3generates a derivative image the first time it is requested from a namespace
a2605313 4until the namespace or the entire imagecache is flushed.
41b394b1 5
9d2e42c5
DP
6Getting Started:
7
81. Upload and enable both the Imagecache and Imagecache UI modules.
9
102. Go to Administer -> Site Building -> Imagecache. Click on the local task tab
11labeled "Add New Preset" to build a new set of image manipulation actions.
12
133. Enter a descriptive name of your choice (e.g. 'product_thumbnail') into the
14"Preset Namespace" box and click "Create New Preset".
15
164. Add actions to your preset that tell Imagecache how to manipulate the
17original image when it is rendered for display. Available actions include
18crop, scale, desaturate (grey scale), resize, and rotate. Multiple actions
19may be added to a preset.
20
215. Each action is configured in its own form, and the actions may be reordered
22from the preset's configuration form. If you need to make any changes to the
23order of actions in a preset, remember to click "Update Preset" when you're
24finished.
25
26Viewing Manipulated Images:
a2605313
DP
27
28Your modified image can be viewed by visiting a URL in this format:
9d2e42c5 29
a2605313
DP
30http://example.com/files/imagecache/preset-name/files/image-name.jpg
31
9d2e42c5
DP
32For example, if your preset is named 'product_thumbnail' and your image is
33named 'green-widget.jpg', you could view your modified image at:
34
35http://example.com/files/imagecache/product_thumbnail/files/green-widget...
a2605313 36
9d2e42c5
DP
37Imagecache also defines a theme function that you can use in your modules and
38themes to automatically display a manipulated image. For example, to use the
39theme function in a .tpl.php file, add the following line where you would like
40the image to appear:
505fd29e 41
a2605313 42<?php
9d2e42c5 43print theme('imagecache', 'preset_namespace', $image_filepath, $alt, $title, $attributes);
a2605313 44?>
505fd29e 45
9d2e42c5
DP
46Change 'preset_namespace' to the name of your imagecache preset and make sure
47that $image_filepath or some other variable contains the actual filepath to
48the image you would like to display.
505fd29e 49
9d2e42c5
DP
50$alt, $title and $attributes are optional parameters that specify ALT/TITLE
51text for the image element in the HTML or other attributes as specified in the
52$attributes array.
505fd29e 53
9d2e42c5 54Using Imagecache with Contributed Modules:
505fd29e 55
9d2e42c5
DP
56Imagecache presets can be put to use in various other modules. For example, when
57using CCK with the Imagefield module, you can use the "Display fields" local
58task tab to choose a preset to apply to images in that field. Similarly, you
59can specify a preset when displaying images attached to nodes using Imagefield
60in a View through the Views UI.
61
62For more information, refer to http://drupal.org/node/163561.
41b394b1 63
9d2e42c5
DP
64(Images, page names, and form field names may refer to previous versions of
65Imagecache, but the concepts are the same.)