简体   繁体   中英

Amazon S3 and PHP

I am building an admin side of an application. It has a page that displays the all images from an amazon s3 folder. Page displays 10 images at a time. So the case is that I have to send 10 request to amazonS3 server to fetch 10 images. Any one knows some other way to get these 10 images by a single request or some thing better?

I am using codeigniter and an amazons3 class ( http://undesigned.org.za/2007/10/22/amazon-s3-php-class )

For every image there will be one http request regardless of any programming language. So unless you use something like image sprites as far as I know there is no other way

You ought to be caching all images from S3 on your local server to reduce S3 requests and bandwidth usage.

Unless every page has unique images this should drastically reduce the number of S3 requests you make - though obviously when the image cache is empty there will still be the same number of requests passed through to S3.

Check out this post . People conclude that using S3 for multiple small objects is going to be very expensive.

May I suggest that depending on your application, you may have one (or a few) zipped (or tared) file that you can fetch at a time, decompress (untar) it on your server and display it in your web app. This is a good choice if the files change less and are fetched a lot of times.

An alternative crazier idea - You could use sprites ;-)

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