lib/mongo_grid.rb in mongo_grid-0.3.2 vs lib/mongo_grid.rb in mongo_grid-0.3.3
- old
+ new
@@ -34,17 +34,16 @@
end
def uploadtogrid(upload,opts={})
filename=upload.original_filename
content_type=upload.content_type
- if /jpg|jpeg|png/ =~ content_type
- if opts[:width]
- %x[resize -fixed -w #{opts[:width]} #{upload.tempfile.path}]
- else
- %x[resize -fixed #{upload.tempfile.path}]
- end
-
- end
+ #if /jpg|jpeg|png/ =~ content_type
+ # if opts[:width]
+ # %x[resize -fixed -w #{opts[:width]} #{upload.tempfile.path}]
+ # else
+ # %x[resize -fixed #{upload.tempfile.path}]
+ # end
+ #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})
gid = grid.insert_one(gfile)
file_size = fsize(length)