Fetch remote image using http.rb (#3114)
This commit is contained in:
committed by
Eugen Rochko
parent
b11c4326d2
commit
79ef8b3653
@ -46,6 +46,9 @@ class MediaAttachment < ApplicationRecord
|
||||
styles: ->(f) { file_styles f },
|
||||
processors: ->(f) { file_processors f },
|
||||
convert_options: { all: '-quality 90 -strip' }
|
||||
|
||||
include Remotable
|
||||
|
||||
validates_attachment_content_type :file, content_type: IMAGE_MIME_TYPES + VIDEO_MIME_TYPES
|
||||
validates_attachment_size :file, less_than: 8.megabytes
|
||||
|
||||
@ -59,10 +62,6 @@ class MediaAttachment < ApplicationRecord
|
||||
remote_url.blank?
|
||||
end
|
||||
|
||||
def file_remote_url=(url)
|
||||
self.file = URI.parse(Addressable::URI.parse(url).normalize.to_s)
|
||||
end
|
||||
|
||||
def to_param
|
||||
shortcode
|
||||
end
|
||||
|
Reference in New Issue
Block a user