require "zip"
require "tempfile"
zip_file = Tempfile.new(["files", ".zip"], binmode: true)
zip_stream = Zip::OutputStream.write_buffer(zip_file) do |zip|
uploaded_files.each do |uploaded_file|
zip.put_next_entry(uploaded_file.original_filename)
uploaded_file.open { |io| IO.copy_stream(io, zip) }
end
end
zip_file.fsync # flush any buffered data to disk
zip_file.rewind
photo.image #=> #<Shrine::UploadedFile>
send_file zip_file.path
--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/c786b8cb-85b1-4bd7-8301-f7be4ffd1a4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/6fea9108-2648-4dd7-b953-b06186897f27%40googlegroups.com.
Thank you for the guide and the wonderful shrine : )