I've done a little bit of initial work with filefield_imagecache.module to try and allow the user to choose different formatters depending on wether or not the node is being rendered as a teaser, or in a full page view. Attempting to extend the filefield_imagecache options on the individual fields settings form so that you can choose a "Preset", and "Display as format" for each case.

I think the best way to do this would be to change the code in fieldfield_imagecache.module in the theme_filefield_imagecache_file_formatter_default function to something like this so you can display the image using one imagecache preset for teasers, and another for full page views.

$presetname = ($teasr) ? $file_formatter_settings['preset_teaser'] : $file_formatter_settings['preset'];
$preset = imagecache_preset_by_name($presetname);

But as far as I can tell there is no way from within the theme_filefield_imagecache_file_formatter_default to know if this field is being displayed as part of a teaser or as part of a full page.

What do we need to do to get filefield.module to make this information available to the theme_ functions? I would be happy to try and code something, but need a push in the right direction on this one ...

Thanks.

Comments

jpetso’s picture

filefield.module should not provide this information to theme functions, but do the right thing for all theme functions alike, without the need to adapt each of those.

But you made me aware of an incredibly interesting idea, which is presets - for filefield display settings. And each of these presets then makes a CCK formatter. That would not only solve this issue (which is hard to get by otherwise) but only #276551: Ability to choose different file formatters in Views.

Thanks for the input, now enjoy the show :)

jpetso’s picture

Status: Active » Closed (duplicate)

dopry posted a patch to issue #279288: There should be per context formatters for FileField: Teaser, Full Node, RSS, so I'm deprecating this one as duplicate. My patch comment #3 of that issue would fix the formatter problem, even though I guess it comes with a slight decrease in usability because of the decoupled admin forms. But hey, flexibility. The patch needs a minor bit of refinement still, but otherwise working nicely. Let's see if dopry likes the preset approach (and comments on it soon, otherwise I'll just commit it independently).