Postponed
Project:
ImageCache
Version:
6.x-2.0-beta10
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Aug 2009 at 13:34 UTC
Updated:
2 Jun 2012 at 21:27 UTC
Doing a theme_imagecache() call on a file that doesn't exist returns invalid data.
For any $preset, e.g. "example_preset", it will pass the image $path to imagecache_create_path() and return a string, so if the $path is empty it returns an invalid string:
<img src="/files/imagecache/example/preset/" />
This is because the imagecache_create_path() function does not verify if the $path exists first, it just assumes it is:
function imagecache_create_path($presetname, $path) {
$path = _imagecache_strip_file_directory($path);
return file_create_path() .'/imagecache/'. $presetname .'/'. $path;
}
This should be modified to verify the path exists first, e.g.:
function imagecache_create_path($presetname, $path) {
if (file_exists($path)) {
$path = _imagecache_strip_file_directory($path);
return file_create_path() .'/imagecache/'. $presetname .'/'. $path;
}
else {
return FALSE;
}
}
Then the rest of the module would need to be updated to handle the FALSE return.
Comments
Comment #1
fizk commentedMarking as ImageCache 2.x Todo.