Reputation: 41442
My web application allows users to upload images of items they are planning on selling. I'm trying to find a good compromise between having the images large enough and detailed enough for buyers to get an idea of the condition of the item and having the images small enough so that they don't slow down the site substantially.
In addition, I will also need thumbnails for a quick view of multiple items.
When a user uploads their file then, should I store both the original copy as well as a resized version on my server? If so, is there a general accepted limit on these file sizes that I should impose to get a good balance of quality and image size?
Upvotes: 2
Views: 1783
Reputation: 6273
I would tackle this issue from another direction. Instead of, upon upload, generating the different file sizes that you need and storing them that way, I would do the following:
Upvotes: 0
Reputation: 1527
Don't impose any limit's to the user. The user might not have the tools or knowledge on how to reduce the size anyway. You can always resize on the server if needed.
I've created several sites that have image galleries and we normally store three files.
Original (This is not necessary if for example the Preview size is big enough for all cases)
Thumbnail (size depends on the design. normally around 120x80)
Preview (size depends on the design. normally around 640x480)
In your case you should probably store the original. What ever sizes you choose make sure that they are same as you show in the client. Browsers are not good at resizing...
Upvotes: 0
Reputation: 306
To answer your specific questions if they are uploading a version that you are then resizing and you don't need the original then discard it. You could even consider ensuring that they upload no larger than your "full size" image requirements to save you some processing.
The limit you want to enforce will depend on all manner of factors including storage space and bandwidth available to you, file formats supported, projections of the number of items for sale and the amount of traffic, the design of the page, browser capability of the majority of your userbase...etc. There is no "generally accepted" limit.
Upvotes: 1
Reputation: 391846
Before sweating the details on size limits, do some math on how many images you'll have, what the average size will be and how much storage actually costs.
You'll find that the time you spend worrying about it isn't worth it. The storage cost is so low that your time is probably better spent on other things.
Upvotes: 1
Reputation: 21213
Small images could still be usable - If you're trying to prevent that, I would go for small+watermark. At least that's what most stock photo sites are doing.
I would also recommend checking out Amazon s3 for storage of a large number of images. Should really help you with the server load.
Upvotes: 2