Class: CckForms::ParameterTypeClass::Image

Inherits:
File
  • Object
show all
Defined in:
lib/cck_forms/parameter_type_class/image.rb

Overview

Represents a single image. A subclass of File.

Direct Known Subclasses

WatermarklessImage

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.file_typeObject



4
5
6
# File 'lib/cck_forms/parameter_type_class/image.rb', line 4

def self.file_type
  ::Neofiles::Image
end

Instance Method Details

#file_typeObject



8
9
10
# File 'lib/cck_forms/parameter_type_class/image.rb', line 8

def file_type
  self.class.file_type
end

#to_diff_value(options = {}) ⇒ Object

Returns a 64x64 IMG



13
14
15
16
17
18
19
20
# 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