Module: ActAsAttachedFile
- Extended by:
- ActiveSupport::Concern
- Includes:
- AttachmentProcessing, StorageImageProcessing
- Defined in:
- app/models/concerns/act_as_attached_file.rb
Instance Method Summary collapse
- #content_type ⇒ Object
- #file_css_class ⇒ Object
- #file_name ⇒ Object
- #generate_file_name ⇒ Object
-
#is_image? ⇒ Boolean
BASE HELPERS.
- #mb_size ⇒ Object
- #path(style = nil) ⇒ Object
-
#recalculate_storage_counters! ⇒ Object
CALLBACKS.
-
#title ⇒ Object
HELPERS.
- #url(style = nil, opts = {}) ⇒ Object
Methods included from StorageImageProcessing
#build_base_image, #build_base_images, #build_correct_preview, #build_square_image, #create_img_dir_path, #destroy_processed_files, #draw_watermark, #prepare_image, #refresh_base_image, #resize_src_image
Methods included from ImageManipulation
#crop_image, #landscape?, #portrait?, #resize_to_larger_side, #resize_to_larger_side!, #rotate_attached_image, #rotate_image, #rotate_left, #rotate_right
Methods included from WatermarkFu
#build_watermarks, #create_watermark, #create_watermark_canvas, #has_watermark?, #need_watermark?, #put_watermark_on_base_image, #watermark_canvas_path, #watermark_dir_path, #watermark_font, #watermark_path
Methods included from AttachmentProcessing
#delayed_file_processing, #set_processing_flags
Instance Method Details
#content_type ⇒ Object
35 36 37 |
# File 'app/models/concerns/act_as_attached_file.rb', line 35 def content_type end |
#file_css_class ⇒ Object
22 23 24 |
# File 'app/models/concerns/act_as_attached_file.rb', line 22 def file_css_class 'f_' + TheStorages.file_ext() end |
#file_name ⇒ Object
31 32 33 |
# File 'app/models/concerns/act_as_attached_file.rb', line 31 def file_name TheStorages.file_name() end |
#generate_file_name ⇒ Object
59 60 61 62 63 |
# File 'app/models/concerns/act_as_attached_file.rb', line 59 def generate_file_name file_name = .instance_read(:file_name) file_name = TheStorages.slugged_file_name(file_name) .instance_write :file_name, file_name end |
#is_image? ⇒ Boolean
BASE HELPERS
55 56 57 |
# File 'app/models/concerns/act_as_attached_file.rb', line 55 def is_image? IMAGE_EXTS.include? TheStorages.file_ext() end |
#mb_size ⇒ Object
39 40 41 |
# File 'app/models/concerns/act_as_attached_file.rb', line 39 def mb_size FileSizeHelper.mb_size() end |
#path(style = nil) ⇒ Object
43 44 45 |
# File 'app/models/concerns/act_as_attached_file.rb', line 43 def path style = nil .path(style) end |
#recalculate_storage_counters! ⇒ Object
CALLBACKS
66 67 68 |
# File 'app/models/concerns/act_as_attached_file.rb', line 66 def recalculate_storage_counters! storage.recalculate_storage_counters! end |
#title ⇒ Object
HELPERS
27 28 29 |
# File 'app/models/concerns/act_as_attached_file.rb', line 27 def title end |
#url(style = nil, opts = {}) ⇒ Object
47 48 49 50 51 52 |
# File 'app/models/concerns/act_as_attached_file.rb', line 47 def url style = nil, opts = {} url = .url(style, opts) return url unless opts[:nocache] rnd = (rand*1000000).to_i.to_s url =~ /\?/ ? (url + rnd) : (url + '?' + rnd) end |