How to create multiple images and put them in one ZIP file for upload using Rails3?

I generate QR codes from the Google APIs on my website as a URL with the parameters passed.

I have about 100 of these codes that are generated from a URL, something like this:

$= image_tag("http://chart.apis.google.com/chart?cht=qr&chl=#{qr.code}&chs=120x120&choe=UTF-8", :size => "120x120")

I want to create a method that goes through my array and generates png files and then puts them in a zip file that I can download with one click.

I tried to use send_data "url", :disposition = > "attachment", :type => "image/png"

This saved only the URL, not the image. Paste the URL into the browser opened a window with the image.

In addition, I could not add all the files to the zip file. Does Rails have its own built-in compression methods?

+3
source share
2 answers

-, QR- Net:: HTTP, QR- Google API . rubyzip, zip . zip- - . , send_data ( send_file, ), zip -.

+5
+1

All Articles