So I'm trying to figure out the best way to go about setting up an image upload system for my site. Basically we have, let's say, 2,000 stores in our database currently (that number expands by the day). I want users to be able to upload images for each store so, in theory, it would be possible for a single store to have multiple images.

Based on my research, it appears that storing paths in the DB as opposed to storing the images directly in the DB would be better since we are talking about a large number of images eventually. I'm also trying to figure out how to associate the images with the store. I am thinking the easiest way would be using the store's unique ID number in the image name and then numbering images sequentially. For example, if store 203 had 2 images, they would be saved as 203_01.jpg and 203_02.jpg.

Is this it the best way to go about doing this? Also, are there any ready made scripts out there that will do this type of task (I also need to create thumbnails) or will it need to be built from scratch?

Member Avatar for diafol

I'd store paths myself. Your naming convention seems fine, although your sequentiasl part (_01,_02) could be awkward. Perhaps attaching the unix timestamp instead:

$name = $store_id . "_" . time();

Ok, it doesn't look as nice, but who cares right?

You can create thumbnails easily with php. Just Google.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.