Sha256: 0508bdfad3f409e01eb4443a8acd44f16d23f54307366d0f59766b43070ac7d7

Contents?: true

Size: 573 Bytes

Versions: 18

Compression:

Stored size: 573 Bytes

Contents

module C80Map

  class MapImageUploader < CarrierWave::Uploader::Base

    include CarrierWave::MiniMagick

    storage :file

    version :thumb do
      process :resize_to_fit => [500,500]
    end

    def store_dir
      "uploads/map/"
    end

    def filename
      if original_filename
        "map_#{secure_token(4)}.#{file.extension}"
      end
    end

    protected
    def secure_token(length=16)
      var = :"@#{mounted_as}_secure_token"
      model.instance_variable_get(var) or model.instance_variable_set(var, SecureRandom.hex(length/2))
    end

  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
c80_map-0.1.0.24 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.23 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.22 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.21 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.20 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.19 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.18 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.17 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.16 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.15 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.14 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.13 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.12 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.11 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.10 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.2 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0.1 app/uploaders/c80_map/map_image_uploader.rb
c80_map-0.1.0 app/uploaders/c80_map/map_image_uploader.rb