Fixes #217 Perform case-insensitive comparison for file extensions

Also include jpeg as a valid photo extension
This commit is contained in:
Mike Koch 2015-04-17 15:10:27 -04:00
parent e1f25b0e52
commit 50da09b201

View File

@ -1487,7 +1487,7 @@ function hesk_getSavedNameUrlForAttachment($att_id)
function hesk_getFontAwesomeIconForFileExtension($fileExtension) function hesk_getFontAwesomeIconForFileExtension($fileExtension)
{ {
$imageExtensions = array('jpg','png','bmp','gif'); $imageExtensions = array('jpg','jpeg','png','bmp','gif');
//-- Word, Excel, and PPT file extensions: http://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions //-- Word, Excel, and PPT file extensions: http://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions
$wordFileExtensions = array('doc','docx','dotm','dot','docm','docb'); $wordFileExtensions = array('doc','docx','dotm','dot','docm','docb');
@ -1509,6 +1509,7 @@ function hesk_getFontAwesomeIconForFileExtension($fileExtension)
$textFileExtensions = array('txt'); $textFileExtensions = array('txt');
$icon = 'fa fa-file-'; $icon = 'fa fa-file-';
$fileExtension = strtolower($fileExtension);
if (in_array($fileExtension, $imageExtensions)) { if (in_array($fileExtension, $imageExtensions)) {
$icon.='image-o'; $icon.='image-o';
} elseif (in_array($fileExtension, $wordFileExtensions)) { } elseif (in_array($fileExtension, $wordFileExtensions)) {