Class: PhotoCook::Resize::MagickPhoto

Inherits:
MiniMagick::Image
  • Object
show all
Defined in:
lib/photo-cook/resize/magick-photo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMagickPhoto

Returns a new instance of MagickPhoto.



21
22
23
24
25
# File 'lib/photo-cook/resize/magick-photo.rb', line 21

def initialize(*)
  super
  @max_width  = self[:width]
  @max_height = self[:height]
end

Instance Attribute Details

#calculated_heightObject

Returns the value of attribute calculated_height.



14
15
16
# File 'lib/photo-cook/resize/magick-photo.rb', line 14

def calculated_height
  @calculated_height
end

#calculated_widthObject

Returns the value of attribute calculated_width.



13
14
15
# File 'lib/photo-cook/resize/magick-photo.rb', line 13

def calculated_width
  @calculated_width
end

#desired_heightObject

Returns the value of attribute desired_height.



11
12
13
# File 'lib/photo-cook/resize/magick-photo.rb', line 11

def desired_height
  @desired_height
end

#desired_widthObject

Returns the value of attribute desired_width.



10
11
12
# File 'lib/photo-cook/resize/magick-photo.rb', line 10

def desired_width
  @desired_width
end

#max_heightObject (readonly)

Returns the value of attribute max_height.



19
20
21
# File 'lib/photo-cook/resize/magick-photo.rb', line 19

def max_height
  @max_height
end

#max_widthObject (readonly)

Returns the value of attribute max_width.



18
19
20
# File 'lib/photo-cook/resize/magick-photo.rb', line 18

def max_width
  @max_width
end

#resize_modeObject

Returns the value of attribute resize_mode.



16
17
18
# File 'lib/photo-cook/resize/magick-photo.rb', line 16

def resize_mode
  @resize_mode
end

#source_pathObject

Returns the value of attribute source_path.



7
8
9
# File 'lib/photo-cook/resize/magick-photo.rb', line 7

def source_path
  @source_path
end

#store_pathObject

Returns the value of attribute store_path.



8
9
10
# File 'lib/photo-cook/resize/magick-photo.rb', line 8

def store_path
  @store_path
end

Instance Method Details

#calculated_aspect_ratioObject



31
32
33
# File 'lib/photo-cook/resize/magick-photo.rb', line 31

def calculated_aspect_ratio
  calculated_width / calculated_height.to_f
end

#desired_aspect_ratioObject



27
28
29
# File 'lib/photo-cook/resize/magick-photo.rb', line 27

def desired_aspect_ratio
  desired_width / desired_height.to_f
end