The Insert module currently supports inserting an ImageCache preset.

However, it doesn't appear to support inserting, say, a thumbnail-sized image with a link to the original, the way you can in Display Fields for an Imagefield CCK field.

Hopefully that made sense... basically I want the ability to insert a thumbnail (imagecache preset I've set up), but have people be able to click the thumbnail to see the full-size image.

Thanks for considering it... very useful module!

Members fund testing for the Drupal project. Drupal Association Learn more


jhodgdon’s picture

And by the way, I'm attempting to get my client who wants this to pay for me to develop this feature (shouldn't be too difficult). But it would be for D6 if I do it...

protools’s picture

sub for 7 too, all the power of the fields where it has got to. In a teaser you can not control a large or small image, a link to the file, too ... may need to revise the architecture of the module ... Very useful functionality and are often required. good module, but the power of the fields should be preserved

jhodgdon’s picture

If you want something different in teaser vs. full page, then you shouldn't be using Insert, IMO. Insert puts an image tag into the page body, so there isn't going to be a way to make it appear different on teaser vs. full page, because it's part of the body's HTML. You need to just use an image field, and not insert it, for that.

protools’s picture

yes, i can use IMCE or many other things, but power of the fields take a lot of things like integration with Views, and teaser, and yes we need to insert image into the body - with float, userfriendly and easy way. Insert can be great tool for this, but very little is not enough.

jhodgdon’s picture

Assigned: Unassigned » jhodgdon

My client agreed to fund the D6 development of this feature. I'm working on it and will provide a patch shortly.

jhodgdon’s picture

Assigned: jhodgdon » Unassigned
Status: Active » Needs review
1.54 KB

Here's a patch against the 6.x-1.x branch, which works for me.

ralphb’s picture

I'd like to see this feature in Drupal 7 as well (see #1391186: Insert as link).

Rameez’s picture

In teaser we can handle the display with imagechace , here we should simply create copy of image by resizing it and linking it to original one. Like in wordpress we get thumb sub-directory in every image folder.

quicksketch’s picture

In teaser we can handle the display with imagechace , here we should simply create copy of image by resizing it and linking it to original one. Like in wordpress we get thumb sub-directory in every image folder.

Take a look at Image Resize Filter.

mattwmc’s picture

Is there anyway to modify the patch to change the link to image source file path?

For instance, for enlarging images I uses a php code to open in new template.

All that is required is sticking this before the relative file path:


Inserted image reads:

Link to "original" would then read:


jorge.suarez’s picture

Here is a patch for D7 version, based on D6 patch provided by jhodgdon. It's working here. Hope it works ok for you as well.

Must apply on modules/insert/includes directory. Sorry for the inconvenience.

jackhutton’s picture

Thank you for the Insert Module and THANK YOU to jorge.suarez and jhodgdon for the work creating the image caches styles with a link back to the original file option. Super useful .. just saved me alot of time.. Thank you!!
ran the patch in #11 and works great. :)

jackhutton’s picture

again, thanks for this work.

Q: How would I make the embedded URL site agnostic? I moved the site from local up to the webserver and the url for the embedded linked image ( which is so so so great! thx ) has the relative sitepath vs. an explicit sitepath.. ?

Just noticed this as the images don't show in the articles using this linked image style..

quicksketch’s picture

Hi guys, I'm not sure about this patch. It's approach really isn't compatible with the D7 approach to image styles (which now avoids the ridiculous "image cache preset list of DOOM", where every preset has 8 different options (preset, preset with link, preset with lightbox, preset with link to preset b, preset with lightbox to preset b, etc).

In the interim, would an approach that simply provided "original_url" as a variable in imagecache-insert-image.tpl.php work for you guys? Otherwise, I think this should be implemented as a second option in the Insert form, which would now look like this:

Insert: [ preset names dropdown | v ] [x] Link to original

Though things get a little hairy since the Link to original checkbox would only show up certain styles. Obviously it wouldn't make much sense for the Link or Original styles.

cheese_monkey’s picture

I would be thrilled with more available variables, so "original_url" would be fine from the perspective of a beginning site modder.

I'm trying to handle using Insert with a wiki-like text format that doesn't permit raw HTML, but that does support a markup for images. I think I've figured out how to emit the markup instead of the HTML, but it assumes that the user is always using this specific markup (say, instead of changing to "Full HTML", which is an option for that userbase). If we're meant to fill out the insertion styles algorithmically, then I'd really like to have the "Text format" variable somewhere. It might already be there, I'm still trying to figure how&where to name the code to run. (Where is "imagecache-insert-image.tpl.php"?)

tfmedia’s picture

+1 for "an approach that simply provided "original_url" as a variable in image-insert-image.tpl.php" in #14. I could really do with this for an educational site.

jmsosso’s picture

Issue summary: View changes

I just implement this for Drupal 7 modifying the template image-insert-image.tpl.php in this way:

<a href="<?php print str_replace("styles/$style_name/public/", '', $url); ?>">
  <img src="<?php print $url ?>" <?php if ($width && $height): ?>width="<?php print $width; ?>" height="<?php print $height; ?>" <?php endif; ?>alt="__alt__" title="__title__" class="image-<?php print $style_name ?><?php print $class ? ' ' . $class : '' ?>" />

I also added more attributes to the a tag to use the “prettyPhoto” plugin to show a zoom effect when the image are clicked.