function asset_file_icon in Asset 5.2
Same name and namespace in other branches
- 6 asset.types.inc \asset_file_icon()
Implementation of hook_asset_type('icon') for file asset type
Related topics
File
- ./
asset.types.inc, line 208 - This file is included by asset_asset_type() and includes all the file and directory specific functions
Code
function asset_file_icon($asset) {
if (strpos($asset->file['filemime'], 'image/') === 0) {
$format = variable_get('asset_file_image_icon', 'default');
if ($format == 'default') {
return file_create_path($asset->file['filepath']);
}
else {
return file_directory_path() . '/imagecache/' . $format . '/' . $asset->file['filepath'];
}
}
$path = pathinfo($asset->file['filepath']);
$icon = drupal_get_path('module', 'asset') . '/icons/' . $path['extension'] . '.png';
if (file_exists($icon)) {
return $icon;
}
}