tags:

views:

23

answers:

3

Hello all, I have a web site on Shared Hosted Server. They have a hard limit of 50,000 files.

I have a while to go yet, but my site allows Image (jpg), file uploads, does anyone know any special tricks to help me get some of my file count back by storing multi image files in one file.

Most of the image files are under about 300k, but they are all different color, sizes, resolution etc.

My images are in groups, so I was thinking of making a ZIP file, and adding all images in a group to a ZIP file, but for speed sake I would want no compression, but was not sure then on the best way to show the image, do I have to extract it to file then serve?

Any ideas anyone? Or any new/different ideas?

Storing the files in a MySQL Db as Blobs is not a option also, as my host has a 500mb limit on the size of a DB.

thanks gggggggg

+1  A: 

If your site becomes very successful, you will need to upgrade your hosting. That's the best answer you can have as writing your site around these restrictions is just going to create terrible code.

I would recommend storing the images in a database, alongside any information you need to tag the images in your application. When you get half-way to your 500mb limit, get an account with less restrictions.

Sohnee
It's not *necessarily* a good idea to put the image itself into the database (as opposed to just storing the location of the file). Sometimes the file system performs better than the database.
Jeremy Stein
thanks guys, looks like I need a new host
gggggggg
@Jeremy Stein - I recommended the database option in tandem with looking at migrating hosts. It's much easier to move a database than thousands of image files. If you go the file system route, you need to be careful about how many images get stored in a directory.
Sohnee
A: 

Theoretically, you could stitch your images together and use CSS to just display the part of the image you want. But, unless you're using this for some clever caching scheme, it's not a good plan for getting around your host's file limit.

Jeremy Stein
A: 

If your limit is only 50k, you're going to have problems no matter what. Putting them on your database will put nasty strain there. Putting them into zip files will just make additional load on your server..

I think your best bet is to move the files off to Amazon's S3. This is really what it was designed to be used for. Basically, when you get file uploads, you hold/queue them locally and then push them out to S3 after you've done whatever validation is necessary. It's generally pretty cheap (8-10 cents/GB?). Even better, as you add more servers or move servers, you won't have to worry about synchronizing filesystems or moving files.

It's a big FTP site in the sky. ;)

Smugmug did exactly this: Their post: http://don.blogs.smugmug.com/2006/11/10/amazon-s3-show-me-the-money/ Amazon's case study: http://aws.amazon.com/solutions/case-studies/smugmug/

CaseySoftware