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
This commit is contained in:
parent
ac148c50b0
commit
fb4a38f607
1 changed files with 3 additions and 3 deletions
|
@ -8,12 +8,12 @@ class AttachmentUploader < CarrierWave::Uploader::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def image?
|
def image?
|
||||||
img_ext = %w(png jpg jpeg)
|
img_ext = %w(png jpg jpeg gif bmp tiff)
|
||||||
if file.respond_to?(:extension)
|
if file.respond_to?(:extension)
|
||||||
img_ext.include?(file.extension)
|
img_ext.include?(file.extension.downcase)
|
||||||
else
|
else
|
||||||
# Not all CarrierWave storages respond to :extension
|
# Not all CarrierWave storages respond to :extension
|
||||||
ext = file.path.split('.').last
|
ext = file.path.split('.').last.downcase
|
||||||
img_ext.include?(ext)
|
img_ext.include?(ext)
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
|
|
Loading…
Reference in a new issue