Class: Alchemy::Custom::Model::ElFinder::Paths::Image

Inherits:
File show all
Defined in:
lib/alchemy/custom/model/el_finder/paths/image.rb

Constant Summary

Constants inherited from ActiveRecordReference

ActiveRecordReference::URI_SPACER

Instance Attribute Summary

Attributes inherited from Base

#path, #root, #volume

Instance Method Summary collapse

Methods inherited from File

#global_id

Methods inherited from ActiveRecordReference

#active_record_instance, #active_record_instance=, #directory?, #file?, file_to_uri, #fisical_path, #mtime

Methods inherited from Base

#absolute?, #basename, #basename_sans_extension, #child_directories, #children, #cleanpath, #directory?, #dirname, #duplicate, #extname, #file?, #fisical_path, #fullpath, #global_id, #initialize, #is_root?, #mime_type, #mtime, #name, #outside_of_root?, #realpath, #relative?, #relative_to, #rename, #to_s, #unique, #with_sub_dirs?

Constructor Details

This class inherits a constructor from Alchemy::Custom::Model::ElFinder::Paths::Base

Instance Method Details

#active_record_classObject



17
18
19
# File 'lib/alchemy/custom/model/el_finder/paths/image.rb', line 17

def active_record_class
  ::Alchemy::Picture
end

#dimObject



36
37
38
# File 'lib/alchemy/custom/model/el_finder/paths/image.rb', line 36

def dim
  "#{active_record_instance.image_file_width}x#{active_record_instance.image_file_height}"
end

#fileObject



21
22
23
# File 'lib/alchemy/custom/model/el_finder/paths/image.rb', line 21

def file
  active_record_instance.image_file
end

#file=(val) ⇒ Object



25
26
27
# File 'lib/alchemy/custom/model/el_finder/paths/image.rb', line 25

def file=(val)
  active_record_instance.image_file = val
end

#full_fill_paylod(payload) ⇒ Object



11
12
13
14
15
# File 'lib/alchemy/custom/model/el_finder/paths/image.rb', line 11

def full_fill_paylod(payload)
  payload[:tmb] = self.tmb
  payload[:original_url] = active_record_instance.image_file.url
  payload
end

#is_image?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/alchemy/custom/model/el_finder/paths/image.rb', line 31

def is_image?
  true
end

#tmbObject

url per la thumb



7
8
9
# File 'lib/alchemy/custom/model/el_finder/paths/image.rb', line 7

def tmb
  active_record_instance.image_file.thumb('100x100#').url
end