简体   繁体   中英

Download multiple images from Amazon S3 in a zip file?

I have a web page on a web hosting and images are stored on Amazon S3. I want with php be able to download multiple images from Amazon S3 through my web page in a zip file.

What are my options and what is the best?

What I know, it is not possible to compress files on S3. Can I use Amazon lambda?

Best solution I've come across.

  1. The user selects on my website which images they want to downloaded.
  2. I get the file name from my database on my web host and download the images from S3 to a temporary directory on my web host.

  3. A zip file is created in a temporary directory and a link is sent to the user. After a certain time, I clear up the temporary directory (with a script) on my web host.

But it would be great if there are a way that did not go through my hosting to create and download the zip-file.

AWS S3 is "basic building blocks", so it doesn't support a feature like zipping multiple objects together.

You've come up with a good method to do it, though you could stream the objects into a zip file rather than downloading them. EC2 instances can do this very quickly because they tend to have fast connections to S3.

Lambda doesn't work for this, as it is only triggered when an object is placed into an S3 bucket. You are doing the opposite.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM