diff options
| -rw-r--r-- | app/models/concerns/file_attachment.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/concerns/file_attachment.rb b/app/models/concerns/file_attachment.rb index 86e5c68..613a6f0 100644 --- a/app/models/concerns/file_attachment.rb +++ b/app/models/concerns/file_attachment.rb | |||
| @@ -23,10 +23,10 @@ module FileAttachment | |||
| 23 | extend ActiveSupport::Concern | 23 | extend ActiveSupport::Concern |
| 24 | 24 | ||
| 25 | STYLES = { | 25 | STYLES = { |
| 26 | medium: { geometry: "300x300>", format: nil }, | 26 | medium: { args: ["-resize", "300x300>"] }, |
| 27 | thumb: { geometry: "100x100>", format: nil }, | 27 | thumb: { args: ["-resize", "100x100>"] }, |
| 28 | headline: { geometry: "460x250!", format: nil }, | 28 | headline: { args: ["-resize", "460x250^", "-gravity", "center", "-extent", "460x250"] }, |
| 29 | large: { geometry: "1600x1600>", format: nil } | 29 | large: { args: ["-resize", "1600x1600>"] } |
| 30 | }.freeze | 30 | }.freeze |
| 31 | 31 | ||
| 32 | IMAGE_CONTENT_TYPES = %w[image/jpeg image/gif image/png image/webp].freeze | 32 | IMAGE_CONTENT_TYPES = %w[image/jpeg image/gif image/png image/webp].freeze |
| @@ -81,7 +81,7 @@ module FileAttachment | |||
| 81 | STYLES.each do |style, options| | 81 | STYLES.each do |style, options| |
| 82 | dest_path = file_path(style) | 82 | dest_path = file_path(style) |
| 83 | FileUtils.mkdir_p(File.dirname(dest_path)) | 83 | FileUtils.mkdir_p(File.dirname(dest_path)) |
| 84 | system("magick", original_path, "-resize", options[:geometry], dest_path) | 84 | system("magick", original_path, *options[:args], dest_path) |
| 85 | end | 85 | end |
| 86 | end | 86 | end |
| 87 | 87 | ||
