954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Setting Up an Image Upload System

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?

jrotunda85
Junior Poster
144 posts since Feb 2011
Reputation Points: 19
Solved Threads: 7
 

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.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: