Class: Uploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::MiniMagick
Defined in:
lib/padrino-cms/lib/uploader.rb

Overview

require ‘carrierwave/processing/rmagick’

Instance Method Summary collapse

Instance Method Details

#cache_dirObject

Directory where uploaded temp files will be stored (default is [root]/tmp)



39
40
41
# File 'lib/padrino-cms/lib/uploader.rb', line 39

def cache_dir
  Padrino.root("tmp")
end

#default_urlObject

Default URL as a default if there hasn’t been a file uploaded



46
47
48
# File 'lib/padrino-cms/lib/uploader.rb', line 46

def default_url
  "/images/" + [version_name, "default.png"].compact.join('_')
end

#fileObject

Storage type



13
# File 'lib/padrino-cms/lib/uploader.rb', line 13

storage :file

#rootObject

Manually set root



27
# File 'lib/padrino-cms/lib/uploader.rb', line 27

def root; File.join(Padrino.root, "public/"); end

#store_dirObject

Directory where uploaded files will be stored (default is /public/uploads)



32
33
34
# File 'lib/padrino-cms/lib/uploader.rb', line 32

def store_dir
  'images/uploads'
end

#thumbObject

Create different versions of your uploaded files



58
59
60
# File 'lib/padrino-cms/lib/uploader.rb', line 58

version :thumb do
  process :resize_to_fill => [60, 60]
end