Commit fb4a38f6077a27ea14709641f7fbe1547f37c8d4
1 parent
ac148c50
Exists in
master
and in
4 other branches
fixes #3115 and adds support for gif bmp & tiff images
when showing image preview check via lowercased extension and adds support for gif bmp & tiff images
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
app/uploaders/attachment_uploader.rb
| @@ -8,12 +8,12 @@ class AttachmentUploader < CarrierWave::Uploader::Base | @@ -8,12 +8,12 @@ class AttachmentUploader < CarrierWave::Uploader::Base | ||
| 8 | end | 8 | end |
| 9 | 9 | ||
| 10 | def image? | 10 | def image? |
| 11 | - img_ext = %w(png jpg jpeg) | 11 | + img_ext = %w(png jpg jpeg gif bmp tiff) |
| 12 | if file.respond_to?(:extension) | 12 | if file.respond_to?(:extension) |
| 13 | - img_ext.include?(file.extension) | 13 | + img_ext.include?(file.extension.downcase) |
| 14 | else | 14 | else |
| 15 | # Not all CarrierWave storages respond to :extension | 15 | # Not all CarrierWave storages respond to :extension |
| 16 | - ext = file.path.split('.').last | 16 | + ext = file.path.split('.').last.downcase |
| 17 | img_ext.include?(ext) | 17 | img_ext.include?(ext) |
| 18 | end | 18 | end |
| 19 | rescue | 19 | rescue |