| 1 |
$Id: README.txt,v 1.1.4.1 2008/12/28 22:54:41 rmiddle Exp $
|
| 2 |
|
| 3 |
README for upload_preview.module
|
| 4 |
================================
|
| 5 |
|
| 6 |
Adds image preview thumbnails to the file attachment section on node editing pages. That way, users can see what image they are dealing with instead of guessing it from the file name. To prevent ultra wide tables, a file is now spread over two lines with the first displaying the image and the filename and the second one containing the checkboxes for deletion and listing, as well as the file size information.
|
| 7 |
|
| 8 |
|
| 9 |
Development
|
| 10 |
===========
|
| 11 |
|
| 12 |
This module provides a hook_upload_preview() which has one parameter: $file. This object is a regular file object. To inspect its properties, simply print_r() it.
|
| 13 |
|
| 14 |
If your module implements this hook, you usually want to restrict the file handling to certain mime types. If you have a preview for this file, return an array (Forms API type). If no module returns anything for a certain file, a placeholder is used instead.
|
| 15 |
|
| 16 |
function hook_upload_preview($file) {
|
| 17 |
if (strpos($file->filemime, 'image/tiff') === 0) {
|
| 18 |
// File handling code here
|
| 19 |
if ($file) {
|
| 20 |
return array(
|
| 21 |
'#type' => 'yourmodule_tiff_image',
|
| 22 |
[ further parameters for your theme function ]
|
| 23 |
);
|
| 24 |
}
|
| 25 |
}
|
| 26 |
}
|