Commit 8925ef9ab8c32d0abdc9c191564e9c8d4fb66ed0
1 parent
f231e19b
Exists in
master
and in
20 other branches
rails4: Select RMagick processor for attachment_fu
Showing
5 changed files
with
11 additions
and
6 deletions
Show diff stats
app/models/image.rb
@@ -6,8 +6,8 @@ class Image < ActiveRecord::Base | @@ -6,8 +6,8 @@ class Image < ActiveRecord::Base | ||
6 | 6 | ||
7 | sanitize_filename | 7 | sanitize_filename |
8 | 8 | ||
9 | - has_attachment :content_type => :image, | ||
10 | - :storage => :file_system, | 9 | + has_attachment :content_type => :image, |
10 | + :storage => :file_system, | ||
11 | :path_prefix => 'public/image_uploads', | 11 | :path_prefix => 'public/image_uploads', |
12 | :resize_to => '800x600>', | 12 | :resize_to => '800x600>', |
13 | :thumbnails => { :big => '150x150', | 13 | :thumbnails => { :big => '150x150', |
@@ -15,7 +15,8 @@ class Image < ActiveRecord::Base | @@ -15,7 +15,8 @@ class Image < ActiveRecord::Base | ||
15 | :portrait => '64x64', | 15 | :portrait => '64x64', |
16 | :minor => '50x50>', | 16 | :minor => '50x50>', |
17 | :icon => '20x20!' }, | 17 | :icon => '20x20!' }, |
18 | - :max_size => 5.megabytes # remember to update validate message below | 18 | + :max_size => 5.megabytes, # remember to update validate message below |
19 | + processor: 'Rmagick' | ||
19 | 20 | ||
20 | validates_attachment :size => N_("{fn} of uploaded file was larger than the maximum size of 5.0 MB").fix_i18n | 21 | validates_attachment :size => N_("{fn} of uploaded file was larger than the maximum size of 5.0 MB").fix_i18n |
21 | 22 |
app/models/reported_image.rb
@@ -5,6 +5,7 @@ class ReportedImage < ActiveRecord::Base | @@ -5,6 +5,7 @@ class ReportedImage < ActiveRecord::Base | ||
5 | 5 | ||
6 | has_attachment :content_type => :image, | 6 | has_attachment :content_type => :image, |
7 | :storage => :file_system, | 7 | :storage => :file_system, |
8 | - :max_size => 5.megabytes | 8 | + :max_size => 5.megabytes, |
9 | + processor: 'Rmagick' | ||
9 | 10 | ||
10 | end | 11 | end |
app/models/thumbnail.rb
1 | class Thumbnail < ActiveRecord::Base | 1 | class Thumbnail < ActiveRecord::Base |
2 | has_attachment :storage => :file_system, | 2 | has_attachment :storage => :file_system, |
3 | - :content_type => :image, :max_size => 5.megabytes | 3 | + :content_type => :image, :max_size => 5.megabytes, processor: 'Rmagick' |
4 | validates_as_attachment | 4 | validates_as_attachment |
5 | 5 | ||
6 | sanitize_filename | 6 | sanitize_filename |
app/models/uploaded_file.rb
@@ -63,7 +63,8 @@ class UploadedFile < Article | @@ -63,7 +63,8 @@ class UploadedFile < Article | ||
63 | has_attachment :storage => :file_system, | 63 | has_attachment :storage => :file_system, |
64 | :thumbnails => { :icon => [24,24], :bigicon => [50,50], :thumb => '130x130>', :slideshow => '320x240>', :display => '640X480>' }, | 64 | :thumbnails => { :icon => [24,24], :bigicon => [50,50], :thumb => '130x130>', :slideshow => '320x240>', :display => '640X480>' }, |
65 | :thumbnail_class => Thumbnail, | 65 | :thumbnail_class => Thumbnail, |
66 | - :max_size => self.max_size | 66 | + :max_size => self.max_size, |
67 | + processor: 'Rmagick' | ||
67 | 68 | ||
68 | validates_attachment :size => N_("{fn} of uploaded file was larger than the maximum size of %{size}").sub('%{size}', self.max_size.to_humanreadable).fix_i18n | 69 | validates_attachment :size => N_("{fn} of uploaded file was larger than the maximum size of %{size}").sub('%{size}', self.max_size.to_humanreadable).fix_i18n |
69 | 70 |