| 1 |
NOTE: These instructions have not been updated yet for Drupal 5.0.
|
| 2 |
Patches are welcome.
|
| 3 |
|
| 4 |
|
| 5 |
The following are instructions on how to install and configure the
|
| 6 |
taxonomy_image.module with Drupal 4.5 or 4.6:
|
| 7 |
|
| 8 |
INSTALLATION:
|
| 9 |
|
| 10 |
Step 1)
|
| 11 |
Properly configure Drupal's built in file system support by following the
|
| 12 |
directions at 'administer >> settings' in the File system settings area.
|
| 13 |
|
| 14 |
|
| 15 |
Step 2)
|
| 16 |
Copy the 'taxonomy_image.module' and 'taxonomy_image.install' files into
|
| 17 |
a 'taxonomy_image' subdirectory within your 'modules' directory.
|
| 18 |
|
| 19 |
|
| 20 |
Step 3)
|
| 21 |
Enable the taxonomy_image module.
|
| 22 |
|
| 23 |
Go to "administer >> modules" and put a checkmark in the 'status' column next
|
| 24 |
to 'taxonomy_image'. This will automatically create the necessary database
|
| 25 |
tables.
|
| 26 |
|
| 27 |
|
| 28 |
Step 4)
|
| 29 |
Configure the taxonomy_image module.
|
| 30 |
|
| 31 |
Go to "administer >> settings >> taxonomy_image" to configure the module.
|
| 32 |
If you properly followed Step 0 above, this module will automatically create
|
| 33 |
the 'picture image path' which defaults to 'files/category_pictures'. You can
|
| 34 |
also configure the module to force pictures to be within a certain size,
|
| 35 |
automatically resizing if needed.
|
| 36 |
|
| 37 |
If you're using taxonomy hierarchies, and you wish to assign one image to
|
| 38 |
an entire tree of terms, enable 'recursive image display'. If you're not
|
| 39 |
sure what this means, don't enable this option.
|
| 40 |
|
| 41 |
|
| 42 |
Step 5)
|
| 43 |
Associate taxonomy terms with images.
|
| 44 |
|
| 45 |
Go to "administer >> categories >> images" and click 'upload image' next to
|
| 46 |
the term(s) that you wish to associate an image. You can preview uploaded
|
| 47 |
images on the same page.
|
| 48 |
|
| 49 |
|
| 50 |
Step 6)
|
| 51 |
Enable permissions appropriate to your site.
|
| 52 |
|
| 53 |
The taxonomy_image.module provides three permissions:
|
| 54 |
- 'access taxonomy images': allow user to see taxonomy images.
|
| 55 |
- 'administer taxonomy images': allow user to configure taxonomy images.
|
| 56 |
- 'can disable taxonomy images': allow user to disable taxonomy images.
|
| 57 |
|
| 58 |
Note that you need to enable 'access taxonomy images' for users that
|
| 59 |
should see the taxonomy images.
|
| 60 |
|
| 61 |
|
| 62 |
Step 7)
|
| 63 |
Update your theme or other php code to display taxonomy images.
|
| 64 |
|
| 65 |
To display a taxonomy image from your theme or other php code, add
|
| 66 |
a call to taxonomy_image_display(). This function requires that you pass
|
| 67 |
in the term id of the term for which you wish to display the appropriate
|
| 68 |
image. For example:
|
| 69 |
taxonomy_image_display($term->tid)
|
| 70 |
|
| 71 |
This will return an <img> tag with the appropriate values for source=,
|
| 72 |
height=, width= and alt=. For example, it may return something like:
|
| 73 |
<img src='files/image.jpg' width='75' height='75' / alt='term name'>
|
| 74 |
|
| 75 |
If you wish to set other img attributes, you can pass them in through a
|
| 76 |
second (optional) function paramter. For example, to put a 2 pixel border
|
| 77 |
around the images being displayed and to set the alt text, you could call as
|
| 78 |
follows:
|
| 79 |
taxonomy_image_display($term->tid, "border='2', target='new'")
|
| 80 |
|
| 81 |
This would then return the following <img> tag:
|
| 82 |
<img src='files/image.jpg' width='75' height='75' alt='term name' border='2'
|
| 83 |
target='new' />
|
| 84 |
|
| 85 |
See the included theme patches (in the 'contributed' folder) for more
|
| 86 |
examples.
|
| 87 |
|