I use the imagefield with multiple values enabled so that I can create a gallery of images. Normally, the imagefield will display all of its images when viewed as a teaser or body.
Currently, the field formatter provides the option to hide all images, or if imagecache is enabled, to shrink the images, however, there is no option to show only a subset of the images.
For example, to show the first image or maybe the first four. This patch allows that and also integrates with imagecache and thickbox if they are available. Please give feedback.
| Comment | File | Size | Author |
|---|---|---|---|
| imagefield_subsets-dingbats.patch | 3.9 KB | dingbats |
Comments
Comment #1
bfdexp commentedRan the patch and it worked somewhat OK. Had issues with views, would not display in some instances. Also how can you run an imagecache preset with the subset if you can only choose one for a teaser or full view. I would suggest moving the subset option to either the image cache module as a option in the preset so that you could adjust the image size and a subset number or make it a tick box on the upload screen in the UI next to the delete. Maybe create a display on teaser option, this way the user can select how many and what pictures they would like for a teaser view differently for each node.
Comment #2
darekw commentedI wasn't able to patch this. It could be because the module code has changed significantly or this being the first time I've tried patching.
A better way to get only the first image to show up in a teaser is to use Contemplate.
Comment #3
dingbats commentedThe patch needed to be edited before using (i.e. the names of the files), but you might be right - the module may have changed significantly. I'll look into when I get the chance or anyone else who wants to push this along.
Comment #4
dopry commentedformatter settings on widgets huh? maybe usable is we call it field_instance_settings['widget']['formatter'] in CCK.. We can explore this idea more once the 6.x's are out.
Comment #5
dopry commentedyeah code your own formatter..
Comment #6
seaji commentedUse this code in node.tpl.php
<?
if ($page!=1) {
$field_yourfield[0]['view']; // First picture
$field_yourfield[1]['view']; // Second picture
$field_yourfield[2]['view']; // etc.
}
?>