Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm building a file storage programme that will also display images in photo galleries to users who upload them. I was wondering if anybody could help me out.

My plan was if an image was wider than 500px then I would resize it to 500px (gallery and mobile use) width and 250px (thumbnail use) width

I have no serious experience with this so I was wondering if anybody could help me. How many different versions of a single image should I store and at what sizes. Thanks

share|improve this question
1  
It depends on what sizes you need them at. You store them at all the sizes you need them at. Disk space is cheap, especially for small files. -- Consider also programmers.stackexchange.com/questions/195388 –  MichaelT Apr 25 '13 at 21:44
add comment

3 Answers

up vote 1 down vote accepted
  • If you are using these images on your website, store them exactly in all different sizes you are going to use on your website.

  • Image Scaling is a very important factor in a website's performance, and saves bandwidth and page-load time.

  • Scale images in accordance to your need, as disk space doesn't costs much.

  • See what google has to say about image scaling https://developers.google.com/speed/docs/best-practices/payload#ScaleImages

share|improve this answer
1  
Are there any articles or anything you have knowledge of so I could learn more –  kev670 Apr 25 '13 at 22:12
    
@kev670 there are mant blog posts out there (countless many) - what problems do you have that you want to learn more? –  MichaelT Apr 26 '13 at 4:30
    
@kev670 see my edited answer –  Kola Apr 26 '13 at 11:34
    
Thanks, Very helpful –  kev670 Apr 27 '13 at 10:57
add comment

Consider resizing the image not on upload but on demand (and caching the results).

This has a bonus feature; whenever you encounter a new use case that requires a new size, you can generate it easily by changing the parameters in the new code. It won't require you to run computation on your entire set of images all at once before it works.

share|improve this answer
add comment

If you are doing this for a web site, and if you are using PHP, there are a set of library functions in PHP that will do this.

It's used for example as part of Wordpress - I expect you could download the source code and go poking around in there to see how its done. It's been years since I last looked in there so I can't be more specific.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.