Class: ElFinder2::Command::Resize
- Defined in:
- lib/el_finder2/command/file.rb
Instance Method Summary collapse
Methods inherited from Base
Methods included from HashUtils
#from_base64url, #to_base64url, #to_path
Constructor Details
This class inherits a constructor from ElFinder2::Command::Base
Instance Method Details
#execute ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/el_finder2/command/file.rb', line 4 def execute source = Paperclip.io_adapters.for(@file.content) dest = Paperclip::TempfileFactory.new.generate(source.path) Paperclip::Processor.new(source.path). convert(@convert_params, source: source.path, dest: dest.path) geometry = Paperclip::Geometry.from_file(dest.path) @file.content = dest @file.dimensions = "#{geometry.width.to_i}x#{geometry.height.to_i}" @file.save render json: { changed: ActiveModel::ArraySerializer.new([@file]).as_json } end |