Module: Ckeditor::Backend::CarrierWave::InstanceMethods

Defined in:
lib/ckeditor/backend/carrierwave.rb

Instance Method Summary collapse

Instance Method Details

#extract_content_typeObject



39
40
41
# File 'lib/ckeditor/backend/carrierwave.rb', line 39

def extract_content_type
  model.data_content_type = Utils::ContentTypeDetector.new(file.path).detect
end

#quality(percentage) ⇒ Object

process :quality => 85



31
32
33
34
35
36
37
# File 'lib/ckeditor/backend/carrierwave.rb', line 31

def quality(percentage)
  manipulate! do |img|
    img.quality(percentage)
    img = yield(img) if block_given?
    img
  end
end

#read_dimensionsObject



47
48
49
50
51
52
# File 'lib/ckeditor/backend/carrierwave.rb', line 47

def read_dimensions
  if model.image? && model.has_dimensions?
    magick = ::MiniMagick::Image.new(current_path)
    model.width, model.height = magick[:width], magick[:height]
  end
end

#set_sizeObject



43
44
45
# File 'lib/ckeditor/backend/carrierwave.rb', line 43

def set_size
  model.data_file_size = file.size
end

#stripObject

process :strip



22
23
24
25
26
27
28
# File 'lib/ckeditor/backend/carrierwave.rb', line 22

def strip
  manipulate! do |img|
    img.strip
    img = yield(img) if block_given?
    img
  end
end