How to let Drupal editors choose an imagecache preset when uploading to imagefield?

1.2k Views Asked by At

Is somebody aware of a module that allows content editors to select an imagecache preset for each node individually? I'd like my editors to be able to choose between 3 different presets each time they upload an image to an imagefield.

Things I already considered:

  • Adding option fields to make a preset selection and then check those options inside the node template to output the image with the right preset. Did that sometime ago but it's not good to maintain when making changes or adding content types.
  • Having 3 imagefields, one for each preset and using radio buttons and Conditional Fields module to only display the currently selected imagefield. Unfortunately Conditional Fields is not recommended for production on Drupal 7 yet.
2

There are 2 best solutions below

1
On

"Adding option fields to make a preset selection and then check those options inside the node template to output the image with the right preset"

  • It would be better to create the function in theme_preprocess_node in your theme's template.php file than node.tpl.php. This way you can maintain the condition in a much better way.

"Conditional Fields is not recommended for production on Drupal 7 yet"

  • I am not sure whats the road map for conditional field module in D7 as similar feature has been added in the D7 form API itself. You might like to check the following links:

http://api.drupal.org/api/examples/form_example--form_example_states.inc/function/form_example_states_form/7

http://randyfay.com/states

0
On

There does appear to be one, Formatter Field:

With this module, you can add a formatter field to page nodes, which is hooked up to the image field. Then when the node is created or edited, the image style can be selected per-node.

It does something like this:

Field Formatter example

Which looks like what you're after.

Be aware it's in -beta2 at the moment so might need a bit of testing