Hi,

I'm having problems with this. The default setup of having "Full page" and "Teaser" imagecache selection is probably fine for most but I need to have 4 presets selected at all times so that every time a new asset gets created there would be 4 imagacache presets used and images created.

I done A LOT of tinkering with this and stuck since it seems that calling theme('imagecache' , $preset, $filepath) more than once does not work. I've narrowed this down to the function

asset_lightbox($assets, $preview = FALSE, $teaser = FALSE)

but it might very well be possible to create this in some other way.

Any help would be great. Is there a way to call imagecache directly without calling the theme function? There must be, I just haven't figured it out.

regards, Logi

Comments

Logi-1’s picture

Well what you do, if you need to, add this to the asset_lightbox function:

if (function_exists('theme_imagecache') && substr($imagecache, 0, 11) =="imagecache:")
{
//Normal asset imagecache function
list($imagecache, $preset) = split(":", $imagecache);
$img = theme('imagecache', $preset, $a->filepath, $asset['caption'], $asset['caption']);

//Here we will build new preset versions using all available presets
$allformatters = imagecache_presets();
foreach($allformatters as $format)
{
//lets get the preset
$realPreset = imagecache_preset_by_name($format[presetname]);
//get the actions for the preset
$actions_for_preset = imagecache_preset_actions($realPreset);
//get the path of the file without the "files" path
$chopedPath = str_replace( file_directory_path(), '', $a->filepath);
//find the correct folder
$dst = file_directory_path() .'/imagecache/'.$format[presetname]. $chopedPath;
//build the imagecache image
imagecache_build_derivative($actions_for_preset, $a->filepath, $dst);
}
}

Hope this helps somebody.

wmostrey’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.