Closed (fixed)
Project:
ImageCache
Version:
4.7.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Feb 2007 at 06:11 UTC
Updated:
15 Feb 2007 at 06:45 UTC
The function imagecache_image_flush was not working for me:
function imagecache_image_flush($path) {
$presets = _imagecache_get_presets();
foreach($presets as $presetid => $presetname) {
$path = file_directory_path() .'/imagecache/'. $presetname .'/'. $path;
file_delete($preset_image);
}
}
the file_delete variable is a typo. The correct function (that works for me) is:
function imagecache_image_flush($path) {
$presets = _imagecache_get_presets();
foreach($presets as $presetid => $presetname) {
$path = file_directory_path() .'/imagecache/'. $presetname .'/'. $path;
file_delete($path);
}
}
Comments
Comment #1
jpsalter commentedthe bug is also in 4.7.x-1.x-dev
Comment #2
quicksketchThanks, this change must've been implemented in HEAD and 5 but not 4.7. I've corrected the function in the 4.7.x version.
Comment #3
jpsalter commentedAnd...
If you have more than one preset my "fixed" function will not work (the $path variable keeps growing). Here is my fix to delete multiple presets:
Comment #4
quicksketchThanks again. We used the exact same solution in 5 and HEAD (and now also 4.7).
Comment #5
(not verified) commented