Fetch remote image using http.rb (#3114)
This commit is contained in:
parent
b11c4326d2
commit
79ef8b3653
8 changed files with 46 additions and 32 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue