Sha256: 5125b273fbd193558767d3308f9d235bf3209e2a6df9e2545b0e60c58d9e1d1d

Contents?: true

Size: 551 Bytes

Versions: 1

Compression:

Stored size: 551 Bytes

Contents

module RailsUploads
  class PresetsController < ApplicationController

    layout false

    def generate
      filename = "#{params[:image]}.#{params[:format]}"
      preset = params[:preset].gsub('-', '_').to_sym
      if Rails.application.config.uploads.presets.has_key?(preset)
        image = RailsUploads::Types::Image.new(filename)
        if image.exists? and !image.exists?(preset)
          image.send :generate_preset, preset
          redirect_to request.url, :cb => Random.rand(100000) and return
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_uploads-0.1.5 app/controllers/rails_uploads/presets_controller.rb