lib/bulldog/attachment/image.rb in bulldog-0.0.11 vs lib/bulldog/attachment/image.rb in bulldog-0.0.12
- old
+ new
@@ -14,12 +14,11 @@
#
# +style_name+ defaults to the attribute's #default_style.
#
def dimensions(style_name)
if style_name.equal?(:original)
- examine
- @original_dimensions
+ from_examination :original_dimensions
else
style = reflection.styles[style_name]
target_dimensions = style[:size].split(/x/).map(&:to_i)
resized_dimensions(dimensions(:original), target_dimensions, style[:filled])
end
@@ -52,10 +51,10 @@
else
output = `identify -format "%w %h %[exif:Orientation]" #{stream.path} 2> /dev/null`
if $?.success? && output.present?
width, height, orientation = *output.scan(/(\d+) (\d+) (\d?)/).first.map(&:to_i)
rotated = (orientation & 0x4).nonzero?
- @original_dimensions ||= rotated ? [height, width] : [width, height]
+ @original_dimensions = rotated ? [height, width] : [width, height]
true
else
Bulldog.logger.warn "command failed (#{$?.exitstatus})"
@original_dimensions = [1, 1]
false