class CckForms::ParameterTypeClass::Image

Represents a single image. A subclass of File.

Public Class Methods

file_type() click to toggle source
# File lib/cck_forms/parameter_type_class/image.rb, line 4
def self.file_type
  ::Neofiles::Image
end

Public Instance Methods

file_type() click to toggle source
# File lib/cck_forms/parameter_type_class/image.rb, line 8
def file_type
  self.class.file_type
end
to_diff_value(options = {}) click to toggle source

Returns a 64x64 IMG

# File lib/cck_forms/parameter_type_class/image.rb, line 13
def to_diff_value(options = {})
  view_context = options[:view_context]

  if value.present?
    id = value.is_a?(BSON::Document) ? value['_id'] : value
    "<img style='width: 64px; height: 64px;' src='#{view_context.neofiles_image_path(id: id, format: '64x64', crop: 1)}'>".html_safe
  end
end