You are here

function asset_file_img in Asset 5.2

Same name and namespace in other branches
  1. 6 asset.types.inc \asset_file_img()

Implementation of hook_asset_type('img') for file asset type

Related topics

File

./asset.types.inc, line 228
This file is included by asset_asset_type() and includes all the file and directory specific functions

Code

function asset_file_img($asset) {
  if (strpos($asset->file['filemime'], 'image/') === 0) {
    return file_create_path($asset->file['filepath']);
  }
  $path = pathinfo($asset->file['filepath']);
  $icon = drupal_get_path('module', 'asset') . '/icons/' . $path['extension'] . '.png';
  if (file_exists($icon)) {
    return $icon;
  }
}