Sha256: 06030ee13ff44d9b3fbc70dee36eaeacc8a23d2dfe0f91fefc23206eae5694f5

Contents?: true

Size: 541 Bytes

Versions: 7

Compression:

Stored size: 541 Bytes

Contents

module RailsUploads
  class PresetsController < ApplicationController

    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 image.url(params[:preset]).to_s, :cb => Random.rand(100000)
        end
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_uploads-0.2.8 app/controllers/rails_uploads/presets_controller.rb
rails_uploads-0.2.7 app/controllers/rails_uploads/presets_controller.rb
rails_uploads-0.2.6 app/controllers/rails_uploads/presets_controller.rb
rails_uploads-0.2.5 app/controllers/rails_uploads/presets_controller.rb
rails_uploads-0.2.4 app/controllers/rails_uploads/presets_controller.rb
rails_uploads-0.2.3 app/controllers/rails_uploads/presets_controller.rb
rails_uploads-0.2.2 app/controllers/rails_uploads/presets_controller.rb