function asset_img_preview in Asset 5
Same name and namespace in other branches
- 6 asset.module \asset_img_preview()
Callback function to output an image for preview of an asset.
1 string reference to 'asset_img_preview'
- asset_menu in ./
asset.module - Implementation of hook_menu()
File
- ./
asset.module, line 694
Code
function asset_img_preview($aid, $module = NULL, $format = NULL) {
$asset = asset_load($aid);
if (!$module || !$format) {
$formatter = asset_get_default_formatter($asset->type, $asset->extension, TRUE);
list($module, $format) = explode(':', $formatter);
}
$src = module_invoke($module, 'asset_formatter', 'img', $asset, array(
'format' => $format,
));
// We're not useing drupal_goto because filenames will have the language code prepended
// return drupal_goto($src);
$src = substr($src, 0, 5) != "http:" ? base_path() . $src : $src;
return header('location: ' . $src);
}