I guess I will start with a little background and then elaborate on the problem.
I run a website for a car dealership with many different locations. The site runs relatively well and all information is stored in a MySQL database except for the image information. Due to the number of cars in inventory the image directory on the server quickly becomes bloated and I am looking for a better way to manage this. I would also like to be able to upload the images through the form that the vehicles are added to the site.
I have racked my brain for hours for what should be a simple answer. I want to be able to upload files to the server through the form rather than the ftp client, but I would like some manageable way to store the files.
My thoughts have been:
make a directory based on the stock-number input and upload the images into that directory. Then when I go to recall the data run a count of the images in that directory to know how many to load. But then I run into the problem of not knowing exactly what the files are called.
I'd also like to be able to automatically generate thumbnails based on a specific size. The images that are uploaded by default are 640 x 480 px and are JPG in format. I currently just run a batch in photoshop to reduce all the image into the correct size thumbnails and store them into the thumbnail directory.
So I guess my problem is 2 fold:
What kind of structure should I upload the files into and how to name them.
And how is the best way to find out how many photos there are and retrieve them?
And I guess I have one other issue I thought of when writing the notes below, whats the best way to delete the images when they are no longer need?
**** Other notes ****
- Images are currently named as stocknumber-picture number. The photos are in order from 1 to 6 so they show up in the correct positions.
- Removing photos of sold cars is currently a pain because I have to go through and manually write a script to delete them from the server.
- The database always keeps a copy of the original stocknumber. This is so whenever it is transferred I do not have to rename the pictures.
I realize the answer is probably simple and staring me right in the face, but I'm tired of being at a loss.