You are here

function _webfm_get_icon in Web File Manager 5

Same name and namespace in other branches
  1. 5.2 webfm.module \_webfm_get_icon()

Helper func to associate the listing icon with the mime type

1 call to _webfm_get_icon()
theme_webfm_attachments in ./webfm.module
Displays file attachments in table

File

./webfm.module, line 846

Code

function _webfm_get_icon($ext) {

  // Try and find appropriate type
  switch (strtolower($ext)) {
    case 'image/gif':
    case 'image/png':
    case 'image/jpg':
    case 'image/jpeg':
    case 'image/bmp':
    case 'image/tiff':
    case 'jpg':
    case 'gif':
    case 'png':
    case 'jpeg':
    case 'bmp':
    case 'tiff':
      $icon = 'i.gif';
      break;
    case 'video/mpeg':
    case 'video/x-msvideo':
    case 'avi':
      $icon = 'avi.gif';
      break;
    case 'video/quicktime':
    case 'mov':
      $icon = 'qt.gif';
      break;
    case 'audio/mpeg':
    case 'mpeg':
    case 'mp3':
      $icon = 'mp3.gif';
      break;
    case 'application/pdf':
    case 'pdf':
      $icon = 'pdf.gif';
      break;
    case 'application/zip':
    case 'application/x-zip':
    case 'application/x-gzip':
    case 'zip':
      $icon = 'zip.gif';
      break;
    case 'application/msword':
    case 'doc':
    case 'odt':
      $icon = 'doc.gif';
      break;
    case 'application/vnd.ms-excel':
    case 'xls':
    case 'ods':
      $icon = 'xls.gif';
      break;
    case 'application/vnd.ms-powerpoint':
    case 'pps':
    case 'ppt':
    case 'odp':
      $icon = 'pps.gif';
      break;
    default:
      $icon = 'f.gif';
      break;
  }
  return $icon;
}