lib/mongo_grid.rb in mongo_grid-0.2.7 vs lib/mongo_grid.rb in mongo_grid-0.2.8
- old
+ new
@@ -36,9 +36,10 @@
def uploadtogrid(upload,opts={})
filename=upload.original_filename
content_type=upload.content_type
if content_type.include?("image")
+ if /jpg|jpeg|png/ =~ content_type
::Zbox::Qm.resize(upload.tempfile.path,opts)
end
data = File.open(upload.tempfile.path)
length=File.size(upload.tempfile.path)
gfile = ::Mongo::Grid::File.new(data,filename: filename, metadata: {content_type: content_type,length: length})