I'm having a few problems involving imagecache/insert.

I have created a couple of imagecache presets for users to insert images - 'portrait' and 'landscape'.

When I upload an image, I can view a thumbnail. When I click 'insert', no image is inserted into the body text field. However, when I select 'automatic' or 'original' as insert styles, the image is inserted correctly.

This is the code produced when inserting the imagecache preset:

<img class="imagecache-landscape" alt="">

This is the code produced when inserting 'automatic'

<img src="http://edu-websites.com/larmenier-prototype/sites/default/files/post_images/model2_0.jpg" alt="" height="201" width="278">

It seems that the insert module is not interfacing with the imagecache module.

Setup:

Drupal 6.16
Insert 6.x-1.0-beta4
ImageCache 6.x-2.0-beta10
Modified Zero Point Theme (tested with Garland and experiencing same problem)

Thanks,

Rob

Comments

jaarong’s picture

I'm not sure if my problem is related or not, but beta4 seemed to break ImageCache functionality for me as well. When I select my ImageCache preset, it inserts the URL for the full image and not the ImageCache URL, but TinyMCE doesn't display it anyway and acts as though the URL is broken. The image is properly uploaded to the URL that is inserted, but it's not displayed and it's not resized. This was working fine in beta3.

jaarong’s picture

I've traced mine to a problem with the Zen template. I'm not sure if this actually affected my results or not, but I do have a different template for insert to use in my template folder.

<div class="story_thumbnail">
<a href="<?php print file_create_url($item['filepath']) ?>" rel="lightbox[story][__title__]" title="__title__"><img src="<?php print $url ?>" alt="__alt__" title="__title__" class="imagecache-<?php print $preset_name ?><?php print $class ? ' ' . $class : '' ?>" /></a>
<p>__title__</p>
</div>

Did these variables change in beta4? I'm not sure why this worked fine in beta3 and then started to not work in beta4.

quicksketch’s picture

Category: bug » support

It's possible. I'd suggest starting with a fresh .tpl.php file from insert and doing you theming over again. Once we get into a final release (not beta) these variables shouldn't be changing, but alas, such is the nature of beta versions that things are likely to change between versions.

jaarong’s picture

I'm sorry, I think I have now effectively hijacked this thread, but I found the problem. I was using the above code to lightbox the image and link to the full version of the file. The above code used to work fine, now it doesn't, and it's because of this variable:

 file_create_url($item['filepath'])

Which created the url to the full image instead of the image-cache version. Is there another way to tell Insert to put in the url for the full image in the tpl file instead?

The new lightbox presets do not seem to work for me. When I hit insert, nothing happens. And that includes when I delete my custom template completely and flush the cache.

quicksketch’s picture

You could try simply doing a str_replace() on $url: str_replace('imagecache/' . $preset_name . '/', '', $url);.

grimer’s picture

I'm quite new to Drupal. Could you please explain Post 6 in easy noob steps?

Thanks,

Rob

jaarong’s picture

Thanks quicksketch, that worked.

quicksketch’s picture

grimer: Copy the "imagecache-insert-image.tpl.php" file from Insert module and put it in your active theme's directory. Clear your caches at admin/settings/performance. Change the .tpl.php file as you want. Support isn't provided writing whatever PHP code you decide to put in there. (subnet_rx got lucky in #5) :P

quicksketch’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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