I have made my own script, as you want to make now.
It's really very simple!
it's basically almost like a guestbook, in it's functionality.
First, you have an upload page. There, you enter title, description, etc. about the image. You might also want the user to choose a category?
Then you use an upload script.
I made my script name the uploaded files a long integer of random chars. I run a loop,
while (is_file($filename . $ext)) {
// generate new random integer;
}
then, after it's uploaded, I simply have another page to view the files.. (For guest viewing).
I store all images in one folder, as I give them random names.
I think it might be a better option to make folders, like:
pictures/username/picturename_randomnumber.ext
I dont know if I would store the path though, as I guess you will anyways dynamically generate the page, on visit.
eg. if you use the picthres/username, you can simply make the script echo out urls like:
echo "<a href=\"?action=view&id={$user_id}\" title=\"\">view images by {$user_id}</a>";
when the user then presses that url, you have some switch or if/else, where you then display images.
I have an included file for image-browsing. The incldued file has three ways to work:
thumb-list, with one thumb (for userlist)
thumb-list, with all thumbs (for looking at one user)
big-image, with one image (when clicked on one picture)
You can there also choose different ways of defining the path to your images.
if you use the username as folder, you always know that:
<img src="pictures/{$username}/{$filename}" /> will work
I however, have made a function that watermarks the images.. eg. I add the URL of my webpage to the bottom, right corner of all images. This is done on-the-fly, eg. I do not replace the originals uploaded by the users.
I also give my users ability to "Optimize" images on the upload page, so they can optimize how many pictures they can have on theire account. (I give different userlevels, which gives both titles and space on the hd).
I hope this gave you some ideas.
Olav Alexander Mjelde
Admin & Webmaster