kenoli — 2012-06-03T22:29:42-04:00 — #1
I am going to need to store a number of image files (up to 1000) of artwork on a site I am creating. I will need to display them as thumbnails (150px), medium sized images (600px) and larger images (900px). There will be occasion to show all the thumbnails on an admin page, where certain qualities are set. Otherwise, I will be displaying up to 25 150px images at a time. The large images (600px & 900px). will be displayed one at a time.
For ease of coding, it is tempting to store them in a database field, retrieve them and size them in php (or html once the image is generated) for insertion where needed. Otherwise, I could store them in a directory and point to them after retrieving their location from a database field resizing them either with php or html. I could also create all three image sizes when uploading and store them in different directories, simply pointing to them in html, but this greatly increases required disk space.
Any opinions of +s and -s? Speed is probably the biggest consideration. I presume resizing in html is the slowest, as it requires downloading the image before resizing it.
rubble — 2012-06-04T02:28:18-04:00 — #2
I would go with option 3. Size on upload and save into different folders with the same name; you would only need one filename in the database and you could then hardcode the path into your code.
mainlink — 2012-06-04T02:33:00-04:00 — #3
I was facing a similar problem and decided to build three different qualities/sizes of an uploaded image. While processing the image, I gave it a unique id and stored additional data inside a db table (title, timestamp etc.).
Storing an image as a blob inside a database is always a bad idea as it reduces speed and encreases db size dramatically.
kenoli — 2012-06-04T20:50:55-04:00 — #4
Thanks for your replies. They make sense. Will follow your suggestions.