없이 원격 이미지를 저장 여기에 내가 컨트롤러종이 클립이 확장
require 'open-uri'
user = User.new
url = "some_remote_image.jpg" #remote image WITH extension
user.image = open(url)
user.save
모델
has_attached_file :image,
:styles => { :thumb => "25x25>", :large => "1000x1000>" },
:path => ":rails_root/images/users/:id/:style/:hash.:extension",
:url => "/images/users/:id/:style/:hash.:extension",
:hash_secret => "hash string"
에게이 작품을 가지고 있지만 전을위한 확장자가없는 이미지를 저장합니다. "some_remote_image." 확장명을 사용하여 업로드하는 모든 것을 게시 양식으로 업로드하는 경우. 혼란 스럽습니다.
난 당신이 user.image = URI.parse를 (URL) – oshikryu
저도 같은 문제를 가지고 있었고, 위의 솔루션은 작동하지만 부작용 하나 개의 스타일 (썸네일)로 만들어지고 의미 생각합니다. 어떻게 대처할 수 있을까요? – Imran