I want to try to make a photo gallery with family pictures. What I am thinking I want to have happen is something like this. I have thousands of photos I want to put all the photos in the database once but be able to search for a specific pic. I want to have different "category's' for example person_one, person_two, person_three, birthday_party, family_reunion, ext. I have a lot of photos that could fall inn a lot of different category's but I only want that photo to be in the database once. So I was thinking I could tag each photo like youtube does. When you upload a video on youtube for the tags you can put as many as you want separated by a comma. What is my best beat going to be?

Thanks for the help all, i agree coppermine and Gallery 3 is a bit more then what i need. I have all the photos organized just using folders on my pc. If i moved the main folder to my server would there be a script I can use to make it go through and populate the database then go back and tag each photo with the appropriate tags and gallery?

You could do something like this to save the photos to the database but would need to weed out the file . and .. you could change the glob command to only select jpg if that is what all the images are.

If as you say you have thousands of photos it would probably be better to do them in batches anyway to save php timing out. In your case I would modify the "Directory to read images from" for each directory and process one directory at a time. Do the different directories contain random images or are they sorted into groups; if grouped you could save that detail into the database at the same time.

You need to decide on what you want from what you have before doing anything to make sure it is correct the first time around.

A couple of things to think about:How do you want to group themAre there some standard tags for each directory - or possibly date taken as that could be found out from the EXIF data.

Yes the folders are all categorized for the most part. If I can make a script that will go through one at a time and save the entire main category first I can make a form to add all the other tags later. I'm not sure how to go about this. I tried to make the code above work but have not had any luck. Do you mind showing me a more complete script or even a complete script from another site, I have not found any. Any additional help is appreciated.

<?php
/*
In this case the database has a table called photo with three columns: ID ( auto index ), path and catagory
You can use this as a trial as you need to decide on your final database design and work around that - you will probaby have more tables interlinked.
This will read the image from the folder and put it into the database with the catogary name
You need to specify the folder to read and the catagory to use
If all the images are jpg you could remove that from the name to save database space and the filename will be in the format: car_photos/07GAJJQE4Y.jpg and there are ways to remove the photos/ and put it back when the photo is displayed again saving database space.
You will need to decide on your folder layout as well to get the paths correct when displaying the images later.
*/
//Connect to database
$username = '';
$password = '';
$database = '';
$conn = @mysql_connect( "localhost", "$username", "$password" );
if (!$conn) die ("Could not connect MySQL");
mysql_select_db( $database, $conn ) or die ( "Could not open database" );
// Directory to read images from - change for each folder
$dir = "car_photos/";
// Catagory tag - change for each folder
$catagory = "cars";
// Read the directory and sellect EVERYTHING
$filenames = glob( "$dir*" );
// Start the loop to read the images
foreach ( $filenames as $filename ) {
// Insert photo into the database
mysql_query("INSERT INTO photo ( 'path', 'catagory' ) VALUES ('$filename', '$catagory') ");
}
?>

@dxm31: Can you provide an example of the directory structure as it currently exists.

Its set up like this nowBirthdays(Main)---->Jim's 12th(1st Sub-Dir) --------->Dinner(2nd Sub-Dir)--------->Six Flags(2ndSub-Dir)---->Jim's 13th--------->And so onFamily Reunion---->2001--------> Breakfast--------> Pikes Peak---->2002

The main thing I want is to be able to tag who is in every photo, then that person becomes a main directory so we can view all photos with Jim or Susan.

I have coped and pasted the code you gave me and still can not get it working. When I echo $filename it displays the same as $dir when I try inserting to the database it add's exactly what $filename and $dir are set too but it dose it three times.

I only have two pictures in the db as of now just to try all my code. When I load this page it puts the pics in to the table except the top row is all the same pic and the second row is four of the second pic. What is the proper way to display the results in a table?