ChrisInCambo
ChrisInCambo

Reputation: 8765

Asynchronously Load Images in Ruby

I have a ruby script that's going to get a whole bunch of images from another server, then stitching them all together with ImageMagik, everything is working fine, only problem is that performance isn't good when the number of images I have to fetch increases as they're being loaded synchronously.

I need something that can go and load all of the images asynchronously then tell me when they're all ready so that I can stitch them together.

I'm not looking for a background process as there's a user waiting around at the other end of this request expecting a stitched together image.

Any ideas?

Cheers,

Chris

Upvotes: 3

Views: 263

Answers (1)

Tanzeeb Khalili
Tanzeeb Khalili

Reputation: 7344

You can use a library like Typhoeus to fetch the images. It can perform HTTP requests in parallel.

Upvotes: 4

Related Questions