Class: ImageUploader

Inherits:
FileUploader show all
Includes:
CarrierWave::MiniMagick
Defined in:
mod/05_standard/lib/image_uploader.rb

Instance Attribute Summary

Attributes inherited from FileUploader

#mod

Instance Method Summary collapse

Methods inherited from FileUploader

#action_id, #cache_dir, #create_versions?, #db_content, #extension, #file_dir, #filename, #mod_file?, #original_filename, #retrieve_dir, #retrieve_path, #store_dir, #store_path, #tmp_path, #url, #url_filename

Methods included from Card::Location

#card_path, #card_url, #page_path

Instance Method Details

#full_filename(for_file) ⇒ Object

add ‘original’ if no version is given



27
28
29
30
31
32
33
34
35
# File 'mod/05_standard/lib/image_uploader.rb', line 27

def full_filename(for_file)
  name = super(for_file)
  if version_name
    name
  else
    parts = name.split '.'
    "#{parts.shift}-original.#{parts.join('.')}"
  end
end

#identifierObject



23
24
25
# File 'mod/05_standard/lib/image_uploader.rb', line 23

def identifier
  full_filename(super())
end

#path(version = nil) ⇒ Object



6
7
8
# File 'mod/05_standard/lib/image_uploader.rb', line 6

def path(version=nil)
  (version && version != :original) ? versions[version].path : super()
end