Download & Extend

Image cache does not work when drupal is installed in subdirectory

Project:Imce CCK Image
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Issue tags:imce image cck imagecache

Issue Summary

i needed imagecache support for imce so i went ahead and modified the code of this module to support it.

im currently doing my first drupal project and this is the first time i looked inside a drupal module. so the modified code might not work in all environments & configurations. use at own risk.

the modification works fully on both my local and production servers and i can now choose all types of imagecache presets (image linked to node, image linked to image, etc).

thanks go out to "obrigado" http://drupal.org/node/359098 for pointing me in the right direction with regards to imagecache integration.

also fixed the edit bug when field is empty http://drupal.org/node/413844

im attaching the modified module file here so the author can integrate the modifications into the next release. sorry dont know how to make patch files.

AttachmentSize
imceimage.module.txt17.32 KB

Comments

#1

#359098: Patch for Basic ImageCache Integration is marked as a duplication of this.

#2

Status:needs work» fixed

Thanks, With a little modification, I commited it to CVS.

#3

Thanks to dj-nitehawk and yang_yi_cn for making this happen!

#4

awesome!!! cheers guys... now i can get future updates...

love the drupal community...

#5

Status:fixed» closed (fixed)

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

#6

Title:full imagecache support added» Image cache does not work when drupal is installed in subdirectory
Category:task» bug report
Priority:normal» critical
Status:closed (fixed)» active

This update does not work when drupal is installed in a subdirectory. The path for the image cache image is output like:
http://www.mysite.com/drupal/sites/default/files/imagecache/200x160//dru...

The extra /drupal/ breaks the link to the image.

#7

I just ran into this the other day... quick and kludgey fix:

Add this around line 365 of imceimage.module

<?php
$item
['imceimage_path'] = str_replace(base_path(), '', $item['imceimage_path']);
?>

Not a long term fix (it only works if you're in a subdirectory...)

Btw I think this should have been its own issue... it's confusing to revise the titles of existing issues.

#8

I am experiencing the same issue. #7 did fix the problem.

#9

Status:active» needs review

I have created a patch. Don't use it, will break non root installs. See below.

AttachmentSize
imceimage.module.patch 710 bytes

#10

Thanks agerson — but careful with the patch, since it breaks Image Cache support for Drupal installs that are not in subdirectories. Needs a conditional or something.

#11

I don't have a root level drupal install to test this with, but what do you think of:

<?php
 
if (base_path() != "/") {
   
$item['imceimage_path'] = str_replace(base_path(), '', $item['imceimage_path']);
  }
?>