function scald_image_scald_prerender in Scald: Media Management made easy 6
Same name and namespace in other branches
- 7 modules/providers/scald_image/scald_image.module \scald_image_scald_prerender()
Implementation of hook_scald_prerender().
File
- scald_image/
scald_image.module, line 108
Code
function scald_image_scald_prerender(&$atom, $context, $options, $mode) {
if ($mode == 'transcoder' && !empty($atom->file_source)) {
// Find out which transcoder to use. This seems unnecesarilly complex.
$config = variable_get('scald_config', 0);
$context_config = $config->contexts[$context]['type_format'][$atom->type];
if (preg_match('/^imagecache-(.*)$/', $context_config['transcoder'], $match)) {
$preset = imagecache_preset_by_name($match[1]);
$dir = file_directory_path();
$path = str_replace($dir, $dir . '/imagecache/' . $preset['presetname'], $atom->file_source);
$atom->file_transcoded = $path;
$atom->rendered->file_transcoded_url = url($path);
}
}
}