Class: Attachs::Console
- Inherits:
-
Object
- Object
- Attachs::Console
- Defined in:
- lib/attachs/console.rb
Class Method Summary collapse
- .convert(source_path, destination_path, options = nil) ⇒ Object
- .find_content_type(path) ⇒ Object
- .find_dimensions(path) ⇒ Object
Class Method Details
.convert(source_path, destination_path, options = nil) ⇒ Object
17 18 19 |
# File 'lib/attachs/console.rb', line 17 def convert(source_path, destination_path, =nil) run "gm convert '#{source_path}' #{} '#{destination_path}'".squeeze(' ') end |
.find_content_type(path) ⇒ Object
5 6 7 8 9 |
# File 'lib/attachs/console.rb', line 5 def find_content_type(path) run "file -Ib '#{path}'" do |output| output.split(';').first end end |
.find_dimensions(path) ⇒ Object
11 12 13 14 15 |
# File 'lib/attachs/console.rb', line 11 def find_dimensions(path) run "gm identify -format %wx%h '#{path}'" do |output| output.split('x').map &:to_i end end |