def img_element(fullpath)
if size = get_image_size(fullpath)
- sizespec = 'width="' + size[:x] + '" height="' + size[:y] + '"'
+ sizespec = 'width="#{size[:x]}" height="#{size[:y]}"'
else
sizespec = ''
end
def get_image_size(fullpath)
if `identify '#{fullpath}'` =~ / JPEG (\d+)x(\d+) /
- return { :x => $1, :y => $2 }
+ return { :x => $1.to_i, :y => $2.to_i }
else
return nil
end
#- don't resize if image is already smaller than destination size
if size = get_image_size(orig)
dest['size'] =~ /(\d+)x(\d+)/
- if (rotate == "90" || rotate == "270") && (size[:x] < $2 || size[:y] < $1) ||
- size[:x] < $1 || size[:y] < $2
+ if (rotate == "90" || rotate == "270") && (size[:x] < $2.to_i || size[:y] < $1.to_i) ||
+ size[:x] < $1.to_i || size[:y] < $2.to_i
cmd = "#{$convert} #{convert_options} '#{orig}' '#{dest['filename']}'"
end
end