I find the templates for the Insert module to be invaluable, but I was wondering: is it possible to have an imagecache-insert-image.tpl.php template for any imagecache preset in particular?

For example, I have an ImageCache preset, "Image-With-Caption," which I would like to theme to have the alt text display below the image as a caption. Is this possible with the current version of Insert, or is it in the realm of possibility?

Captions are hard to do by hand for most users of my sites, and the easier I can make it for them, the better.

Comments

quicksketch’s picture

Category: support » feature

It's not currently supported to have per-preset templates (though it could be), so I'll move this to a feature request. For the time being though, you can use IF statements inside of the one imagecache-insert-image.tpl.php file.

<?php if ($preset == 'image_with_caption'): ?>
  <div>
  <img ... />
  <div class="caption">...</div>
  </div>
<?php else: ?>
  <img ... />
<?php endif; ?>
geerlingguy’s picture

I see - thanks for the help! This module's been extremely helpful, and I've started putting it on every Drupal site I develop; there's no better way to manage files/images in most situations.

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new2.62 KB
new2.64 KB

I've committed this patch which enables templating per ImageCache preset (or Image style in Drupal 7). You can now name your templates imagecache-insert-image--[preset-name].tpl.php to target an individual preset. I also updated the README.txt to document this functionality.

geerlingguy’s picture

Very, very nice. I'll be testing it next week.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.