LinkedPhotoImport

From Bitpost wiki
Jump to: navigation, search

Requirements:

  • Gather photos from several locations (Windoze PC's) into one linux-based central media repository (aka mediacenter)
  • Leave the photos at the original locations
  • Anticipate some maintenance of photos at the original locations
  • Use gallery (a great LAMP webapp) to manage the mediacenter photos
  • Minimize duplication on the mediacenter
  • Management should include creation of a public directory for shared photos
  • Access to public photos via the web and for screensavers

Solution components:

  • gallery on mediacenter
  • galleryadd.pl, for scripted uploads to gallery
  • xscreensaver on mediacenter
  • Windows nightly batch-file task to copy new photos to mediacenter
  • mediacenter nightly cron job to import new photos
  • linked photo import script
  • fix symlinks script
  • Four directories on mediacenter
  • archive - holds original photos
    dump - holds newest photos and symlinks to old in archive
    managed - holds symlinks to archive
    public - symlink to public directory in managed
    

Process:

First, create the directory structure on mediacenter:

mkdir /media/photos/unmanaged
mkdir /media/photos/unmanaged\archive
mkdir /media/photos/unmanaged\dump_cameras_here
mkdir /media/photos/managed
mkdir /media/photos/public

Set up a samba share for dump_cameras_here.

Next, set up a task on each of the Windoze PC's to copy files to the share every night. This will only copy files that have not already been copied:

xcopy /D /Y /S c:\myphotos\* \\mediacenter\dump_cameras_here\

You might as well run the task next.

Now to set up the mediacenter. Install gallery, and configure it to store its data directory here:

/media/photos/managed/gallery-data

Now all we need is the linked photo import script! You'll have a lot of photos in the dump directory at this time. The script will take those photos, import them, and move them to the archive dir. It will also set up symlinks from dump_cameras_here to archive, so the nightly copies from the Windoze boxes only copy new photos. It will also find the copies of the photos in the gallery-data directory and replace them with symlinks to the photos in archive.

I went through a lot of pain getting this thing working. It's in pretty good shape, but you will need to make a few tweaks to it to match your installation.

  • Update the directory locations at the top to match your setup.
  • In gallery, add a top-level album named "unsorted". Use galleryadd.pl with the "-l" option to list the albums, and get the number for the unsorted album. Update the script to use that album number.
  • Update the username and password to match a valid user in your gallery installation.
  • Finally, try out the script with a small photo set; wash, rinse, repeat as needed.

With a little luck you'll have it up and running in short order.

You're ready to manage your photos in gallery now. To share:

  • Make a top-level public album in gallery.
  • Set the permissions to allow Everybody to view it
  • Remove permissions from other top-level albums
  • Create a symlink to /media/photos/managed/gallery-data/albums/public in a convenient location
  • Share the symlink over samba, etc.
  • Move photos into and out of the public album in gallery, as desired, and they'll become available in the public share.

One more note: many changes you make to a photo in gallery will break the symlink. The most obnoxious is rotating your pictures, which you'll inevitably have to do (since the import script is not yet smart enough to auto-rotate using EXIF data). Rotate the picture, making sure you do NOT have the "Preserve Original" checkbox checked, then use this script to fix the symlinks. Do this before you move the pictures from the import directories, and your originals will be properly rotated and symlinked.