class ElFinder2::Command::Dim

Public Instance Methods

execute() click to toggle source
# File lib/el_finder2/command/dim.rb, line 4
def execute
  images = @targets.inject({}) do |hash, image|
    hash[image.path_hash] = image.url(:thumb)
  end

  render json: { images: images }
end

Private Instance Methods

parse_params!(params) click to toggle source
# File lib/el_finder2/command/dim.rb, line 12
        def parse_params!(params)
  target = params[:target]
  fail ElFinder2::Error.new(%w(errCmdParams dim)) unless target

  path = to_path(target)

  @image = ElFinder2::Image.find_by_path(path)

  fail ElFinder2::Error.new('errFileNotFound') unless @file

  @download = params[:download] == '1'
end