Automatically Adding New Photos

greenleaf_the_savage

Joined: 2008-02-11
Posts: 12
Posted: Mon, 2008-04-28 15:53

I've been wondering about the possibility of having Gallery scan an upload directory for new items to add. Currently I add new photos by copying them from my digital camera to my server and then opening the admin console to use the add from local server option to get them to show up in the gallery. What I would like to do is simply put the files onto the server and have Gallery scan the directory and add the new items to the database, preferably run as a cron job. I know enough about shell scripting and imagemagick to put the photos where they need to go and do the resize operations automatically, but I'm not familiar enough with databases to automate the tasks of adding entries.

I've tried the galleryadd.pl script, and it worked great, provided I knew the ID of the album I wanted to add photos to and didn't want to create a new album. The problem is that I want to put each new set of photos into its own album. I didn't really get any help with that script, so I'm asking for help here.


Gallery version = 2.2.4 core 1.2.0.6
PHP version = 5.2.1 apache2handler
Webserver = Apache/2.2.3 (Ubuntu) PHP/5.2.1
Database = mysqli 5.0.38-Ubuntu_0ubuntu1.2-log
Toolkits = Dcraw, Exif, Getid3, LinkItemToolkit, Thumbnail, ImageMagick, SquareThumb
Operating system = Linux 2.6.20-16-generic

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2008-04-29 11:59

How are you intending to distinguish which photos go in which new album, and what that new album should be called/where should it be located?

 
greenleaf_the_savage

Joined: 2008-02-11
Posts: 12
Posted: Tue, 2008-04-29 14:01

Right now I create a folder on the server with the date the photos were downloaded and put the pictures there. then I log into the admin console and add items from the parent album of my digital camera photos and add the folder from the server.

The folder hierarchy looks kinda like this:

Gallery
|-Digicam
| |-<year>
| | |-<date>
| | | |-<pic 1>
| | | |-<pic 2>
| | | etc.

I looked at the structure of where Gallery is storing the photos, and if I could have Gallery scan that folder structure and add anything new to the database, that would be wonderful. Then I could just put the photos where I want them in the filesystem and Gallery would find them and add them to the database. I know that software can scan a directory structure and add new items to a database, because I have Firefly Media Server hosting all of my music, and it scans my iTunes directory and adds anything new I add to iTunes. I basically want that same functionality in Gallery. I just don't have the knowledge to do it myself and don't know where to start.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2008-04-29 14:46

Are you aware that the "add from local server option" already scans directories recursively? So you only need to run one command regardless of how many albums your're uploading?

 
greenleaf_the_savage

Joined: 2008-02-11
Posts: 12
Posted: Tue, 2008-04-29 15:44

I am aware of that. I'm also aware of the fact that when I tried that for adding photos that were several folders deep, it created copies of the folders leading to it, if I recall correctly.

What I want is for it to scan on its own, once or twice a day, and add anything new to the database. That way I only have to run a script to move the pictures from the camera to the server, and let it take care of the rest.