How would you check if a file is an image? I\'m thinking you could use an method like so:
def image?(file)
file.to_s.include?(\".gif\") or file.to_s.includ
Please check it once
MIME::Types.type_for('tmp/img1.jpg').first.try(:media_type)
=> "image"
MIME::Types.type_for('tmp/img1.jpeg').first.try(:media_type)
=> "image"
MIME::Types.type_for('tmp/img1.gif').first.try(:media_type)
=> "image"
MIME::Types.type_for('tmp/ima1.png').first.try(:media_type)
=> "image"