diff options
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/concerns/file_attachment.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/concerns/file_attachment.rb b/app/models/concerns/file_attachment.rb index 62213123..e577c7fa 100644 --- a/app/models/concerns/file_attachment.rb +++ b/app/models/concerns/file_attachment.rb | |||
| @@ -98,11 +98,11 @@ module FileAttachment | |||
| 98 | generate_all_variants(original_path) | 98 | generate_all_variants(original_path) |
| 99 | end | 99 | end |
| 100 | 100 | ||
| 101 | def generate_variants(original_path) | 101 | def generate_variants(original_path, extra_args = []) |
| 102 | STYLES.each do |style, options| | 102 | STYLES.each do |style, options| |
| 103 | dest_path = file_path(style) | 103 | dest_path = file_path(style) |
| 104 | FileUtils.mkdir_p(File.dirname(dest_path)) | 104 | FileUtils.mkdir_p(File.dirname(dest_path)) |
| 105 | system("magick", original_path, *options[:args], dest_path) | 105 | system("magick", original_path, *extra_args, *options[:args], dest_path) |
| 106 | end | 106 | end |
| 107 | end | 107 | end |
| 108 | 108 | ||
| @@ -120,7 +120,8 @@ module FileAttachment | |||
| 120 | elsif VECTOR_CONTENT_TYPES.include?(upload_content_type) | 120 | elsif VECTOR_CONTENT_TYPES.include?(upload_content_type) |
| 121 | generate_svg_variants(original_path) | 121 | generate_svg_variants(original_path) |
| 122 | elsif RASTERIZED_CONTENT_TYPES.include?(upload_content_type) | 122 | elsif RASTERIZED_CONTENT_TYPES.include?(upload_content_type) |
| 123 | generate_variants("#{original_path}[0]") | 123 | generate_variants("#{original_path}[0]", |
| 124 | ["-background", "white", "-alpha", "remove", "-alpha", "off"]) | ||
| 124 | end | 125 | end |
| 125 | end | 126 | end |
| 126 | 127 | ||
