Imagecache is creating duplicate images for files with spaces in the name. I can't figure out if it is a .htaccess rule causing the issue, or if its likely to be something else. The .htaccess is pretty standard with a rule to turn of mod_security conflicts.
It seems every request results in a new file but only when spaces are in the filename. The file gets listed as www.Mysite.com/files/imagecache/gallery_fullsize/files/gallery-images/la... in the page source. The file in question is called laura s.jpg.
The issue node/129433 caused the path to be put through drupal_urlencode() eg drupal_urlencode($path) to be added to the imagecache function. Removing it allows my image to appear without the duplication, but i guess it opens it back up to the problems with other characters in the filename. How can i fix this?
I'm using Drupal 5.2 on Linux with Apache.
Im considering overridding the file_create_name function in file inc to make sure files have any spaces removed, but that may not be possible.
Thanks,
Drew
Comments
Comment #1
dopry commentedDoes the transliterate filename module solve your problems?
Comment #2
dopry commentedinactive over a month.
Comment #3
wolv3rin3 commenteddrupal: 5.6
imagecache.module,v 1.19.2.28 2007/06/16 17:22:41 dopry Exp
quick workaround/patch:
In case you already have uploaded a lot of problematic files (with space in their filename):
1) download and install the transliteration module
http://drupal.org/project/transliteration
2) enabled the transliteration module (which will fix future upload problem)
3) replace the original theme_imagecache function by this one:
this will use the transliteration module to encode the filename
4) flush your imagecache preset
Comment #4
drew reece commentedFWIW,
Transliteration seems to be doing the job well, I didn't get around to testing until I recently upgraded the Drupal core.
Thanks.
Drew
Comment #5
idflorin commentedthis is not working for me at Modern Dandies :(
Comment #6
drew reece commentedTransliterate will only work for new files, not ones existing uploads on the server.
Please elaborate on what you are seeing, what you have tried.
Drew
Comment #7
idflorin commentedI installed the patch from #3.
I edited few posts and added new images.
I flushed again the presets but :( no success.
No errors where generated.
Comment #8
drew reece commentedIt seems like the transliteration module isn't working for you. Test with the uploading files, since I can say that should work, I haven't used the function @3 so I can't say if that is correct.
If it doesn't work try a clean test install to eliminate problems with other modules or patches you may have in your Drupal install.
Drew