Module: AttachmentSaver::Processors::RMagick::Operations
Instance Method Summary
collapse
#cover_and_crop, #expand_to_fit, #scale_by, #scale_dimensions_to_fit, #scale_to_cover, #scale_to_fit, #shrink_to_fit, #squish
Instance Method Details
#corrected_mime_type ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/processors/r_magick.rb', line 83
def corrected_mime_type
case mime_type
when 'image/x-jpeg' then 'image/jpeg'
when 'image/x-magick' then nil
else mime_type
end
end
|
#crop_to(new_width, new_height, &block) ⇒ Object
112
113
114
115
116
|
# File 'lib/processors/r_magick.rb', line 112
def crop_to(new_width, new_height, &block) image = crop(Magick::CenterGravity, new_width, new_height, true)
image.extend Operations
block.call(image)
end
|
#file_type_extension ⇒ Object
91
92
93
94
95
96
|
# File 'lib/processors/r_magick.rb', line 91
def file_type_extension
case format.downcase
when 'jpeg' then 'jpg'
else format.downcase
end
end
|
#height ⇒ Object
102
103
104
|
# File 'lib/processors/r_magick.rb', line 102
def height
rows
end
|
#resize_to(new_width, new_height, &block) ⇒ Object
106
107
108
109
110
|
# File 'lib/processors/r_magick.rb', line 106
def resize_to(new_width, new_height, &block)
image = resize(new_width, new_height)
image.extend Operations
block.call(image)
end
|
#width ⇒ Object
98
99
100
|
# File 'lib/processors/r_magick.rb', line 98
def width
columns
end
|