I have a site which uses imagefields and imagecache modules, in addition to the the imce module. The file system is a private file system, so hook_file_download() gets invoked each time an image is viewed/downloaded. However, as imagecache generates images as needed, the images don't always exist when imce_file_download() is called. This means that the function filesize() on line 104 of imce.module is being called on a non-existent file, giving a php error like:
filesize() [<a href='function.filesize'>function.filesize</a>]: stat failed for 1 in sites/all/modules/imce/imce.module on line 104.
I tried changing the weights of the modules in the system but the problem still occurred. Ideally the imce module should only return the appropriate headers (or -1) if that image is controlled by the module, and return NULL otherwise. As imagecache images are not imce images, shouldn't it return NULL for them? That's a bigger change though and is open to debate, so the quick solution is to ensure that the file exists before executing that code, which is what the attached patch does.
Cheers,
Stella
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 722176.patch | 1.67 KB | stella |
| hook_file_download.patch | 694 bytes | stella |
Comments
Comment #1
stella commentedPatch re-roll.
Comment #2
ufku commented