0
我試圖使用在軌道上回形針保存Base64編碼字符串,但生成的文件沒有擴展回形針:保存Base64編碼的文件,保存沒有擴展
編碼字符串如下:
{"model"=>{"photo"=>"data:image/jpeg;base64,/9j..}
回形針配置
has_attached_file :photo,
:styles => { medium: "380x380>", small: "200x200>", thumb: "100x100>" },
:path => ":rails_root/model/:style/:id.:extension",
:url => "/object_image/model/:style/:id.:extension",
:default_url => "/images/default-avatar.png"
validates_attachment_content_type :photo,
:content_type => ["image/jpg", "image/jpeg",
"image/png", "image/gif"]
生成的文件是:1.
任何幫助是appeciated。 謝謝