Download & Extend

Wrong Imagecache File Path if User Changes "File System Path"

Project:ImageCache
Version:6.x-2.0-beta10
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hey everyone,

I've recently noticed a bug in the Imagecache filepath if the user ever changes the "File System Path" for the site (located at /admin/settings/file-system).

In our use case, we needed to change the file system path from the development server to the production server. Before using imagecache, we were able to handle this change with symlinks from the old files folder to the new files folder.

But once we use Imagecache, both the original file system path and the new file system path appear in the imagecache link to the image. Here's how the imagecache link looks once we change the file system path:

http://www.example.com/[newfilesystempath]/imagecache/[presetname]/[oldfilesystempath]/image.jpg

As a result, the imagecache version of the image doesn't display. Flushing the imagecache preset doesn't seem to work either because imagecache does not seem to know to regenerate the image if the file system path to the original image has been changed.

Any ideas for how to fix this? I think it would be best not to hard code the file system path directly into the imagecache link.

Thanks,
Ben

Comments

#1

Hello!
I had the same problem. I've made this query in PHPMYadmin to replace the path

UPDATE files SET filepath = REPLACE(filepath,"sites/default/files/","")

I am not sure yet if this will work. I am trying now to fix my site.

#2

Yeah, that works!
But I can't fix the node images to show, only the imagecache thumbs.

#3

After that is enough to delete the caches. And my site is fixed now. I've fixed 3 sites in this way when moving them from different installations to one installation of Drupal.

#4

Can you please help with how to run this query? When I put that string in phpAdmin and press Run Query, I get a message saying: You have to choose at least one column to display. Not sure what to do. Thank you in advance for any pointers here!

#5

Yes this is definitely an issue with imagecache. I have exactly the same problem on a test site I'm experimenting with.

I can get it working fine with the file system set to private, but set to public and it all goes haywire.

A google search shows that tons of people have problems getting imagecache to function correctly - this is probably one of the major causes.

#6

I take it back...

Fixed this by changing the chmod permissions of sites/default and all subdirectories so that public could read, and owner/group can read/write/execute.

#7

Also, FYI i found this post to fix my particular problem: http://stackoverflow.com/questions/1578340/drupal-imagecache-not-working
particularly:

"Imagecache does not work when friendly url's are off. If this is the case, it can not 'find' the path to its folder in sites/default/files. When I turned them on, the folder with the name of the setting was created ok. The Imagecached images don't appear in here though. I'm putting it down to switching dev from Win to Mac, as a few people suggested on the Drupal forums. I'm hoping the issue will be fixed when I return back to a Win machine ... – stef Oct 18 at 16:03"

#8

#9

Subscribing, what is the best method for this please?
Having the same issue!
greetings, Martijn

#10

terko - #1 was totally the clue to my problem; thanks!

nobody click here