Skip to content

Instantly share code, notes, and snippets.

View Xosmond's full-sized avatar
🏠
Working from home

Jordano Moscoso Xosmond

🏠
Working from home
View GitHub Profile
@Xosmond
Xosmond / download_zip.rb
Last active October 20, 2017 20:26 — forked from prog1dev/gist:62660be194ce4aec73721a0af1665983
Create zip on the fly
def download_zip(image_list)
unless image_list.blank?
file_name = 'pictures.zip'
stringio = Zip::ZipOutputStream::write_buffer do |z|
z.put_next_entry("empty_folder/") ## Create a folder
image_list.each do |img|
title = img.title
title += '.jpg' unless title.end_with?('.jpg')