Ruby on Rails: How do you check if a file is an image?

后端 未结 6 1849
醉酒成梦
醉酒成梦 2020-12-28 17:02

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         


        
6条回答
提交回复
热议问题