lib/paperclip-dimension.rb in paperclip-dimension-0.3.0 vs lib/paperclip-dimension.rb in paperclip-dimension-0.3.1
- old
+ new
@@ -32,9 +32,10 @@
end
def save_dimensions_for(name)
dimension_hash = {}
attachment = self.send(name)
+ return unless attachment.content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}
styles = [:original]
styles += attachment.styles.keys if attachment.styles
styles.each do |style|
geo = ::Paperclip::Geometry.from_file(attachment.queued_for_write[style])
dimension_hash[style.to_s] = [ geo.width.to_i, geo.height.to_i ]