2

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

1
  • 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
    – user40980
    Apr 25 '13 at 21:44
2
  • 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

3
  • 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?
    – user40980
    Apr 26 '13 at 4:30
  • @kev670 see my edited answer Apr 26 '13 at 11:34
1

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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