advice for assets

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 109
Joined: Thu May 03, 2012 7:22 am

Sat Aug 18, 2012 7:35 am

Hey guys, I'm building my own cms and I was wondering about what is the best way to store images/audio/docs etc. that are uploaded by the users. Let's say you have an online store. You have some products. Of course - you'll have images. It's easy to put an upload button and upload all images in a directory. But I've seen some people first make a "resources" folder and upload new files there. Then, if the user needs to use a certain image a second time, he won't have to upload it again, therefore less harddrive usage, maybe a little optimized and less traffic. I just need some opinions what are the ups and downs of this approach and share if there is a better way :)

php-forum Fan User
php-forum Fan User
Posts: 622
Joined: Fri Aug 05, 2011 9:53 am

Sun Aug 19, 2012 12:02 am

It's usually better to have a directory which contains all of your images, or if there a clear distinctions between images - to have sub folders from there.
For example -
resources -- contains general images
|- products -- images of any products
|- users -- User icons etc.

It just makes managing things a bit easier. But it's only really needed if you think there are going to be loads of images.

From performance point of view - you may want to make thumbnail style images, a bit like ebay where the listings page has a smaller version of the larger version on the actual listing page.

Post Reply