Skip to content

Commit

Permalink
Added few more mime type that needs over-ride
Browse files Browse the repository at this point in the history
  • Loading branch information
pradpnayak committed Feb 5, 2019
1 parent 878a913 commit 8ece24f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CRM/Utils/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,18 @@ public static function getImageURL($imageURL) {
$path = $url = $imageURL;
}
$fileExtension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
$mimeType = 'image/' . ($fileExtension == 'jpg' ? 'jpeg' : $fileExtension);
//According to (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types),
// there are some extensions that would need translating.:
$translateMimeTypes = [
'tif' => 'tiff',
'jpg' => 'jpeg',
'svg' => 'svg+xml',
];
$mimeType = 'image/' . CRM_Utils_Array::value(
$fileExtension,
$translateMimeTypes,
$fileExtension
);

return self::getFileURL($path, $mimeType, $url);
}
Expand Down

0 comments on commit 8ece24f

Please sign in to comment.