Valid HTML 4.01 Transitional

New Album in Images Directory

James F. Carter <jimc@math.ucla.edu>, 2013-08-26

You're going to take a set of photos which you want to turn into an album in the Carter Family Photo Album. This happens infrequently enough that the details are forgotten each time and have to be re-researched. The specific project this time is our forthcoming trip to the Rhine river and Switzerland.

Directory Structure

Root Directory

The root directory on Jacinth is /home/images. The URL of the toplevel index is http://jacinth.jfcarter.net/images/images-index/ (courtesy of a symlink from /home/httpd/htdocs/images to the containing directory). You don't need to mess with index.shtml in that directory but you do need to update index.incl.

New Volume

The second level volumes are about 50Mb to 100Mb in size. If you need to make a new one, it's called images(number), e.g. images07. Make that directory, and copy into it index.shtml from a recent previous volume. Edit index.shtml updating all the years and all the instances of the volume number. The index includes ../images-index/index.incl. Edit that file putting in a row for the new volume, and adjust the year of the previous one, which likely will end with &hellip; (…).

New Album

Pick a name for your album, typically ending with the year so it is unique, e.g. europe13. Make a directory for the original photo images: /home/images/images.orig/europe13. Make the album directory /home/images/images07/europe13. Change into it so the examples can be relative paths. For the examples I'm copying files from a neighboring album called xyz13. Do these steps:

mkdir ./img # Most of the content ends up here
cp ../xyz13/rebuild.sh .
ln -s ../../images.orig/europe13 ./orig

Execute rebuild.sh to create all the generated content. If you edit the HTML files above the marker line, your changes will be preserved. If you do photo editing on an image, it will not be overwritten. If you need a file to be rebuilt, e.g. because the orientation was wrong, remove it first. The script goes like this (comments omitted):

#!/bin/bash
dir=${0%/*}
if [ "$dir" = "$0" ] ; then dir=. ; fi
cd $dir || exit 4
../../bin/mogrify.pl photolog.txt index.html ./orig img

Basically the middle 3 lines change to the album directory so the arguments to mogrify.pl can be relative paths, which is essential to get the HTML links right. The arguments are:

  1. photolog.txt: Log file listing images and captions
  2. index.html: Name of toplevel index file (to be written)
  3. ./orig: Directory containing the original images
  4. img: Subdirectory where to put the generated content; '.' also works but I decided the result was too messy.

Create the file ./photolog.txt (see next section).

Photo Log File

The photo log file lists the images in the album, in order of appearance. Normally you will edit it on your pocket computer, not Jacinth. Lines beginning with #, and empty lines, are ignored. Remaining lines have three fields separated by whitespace. (I normally use tabs, but blank(s) will work.) They are:

You will want to create this file on your pocket computer and periodically upload it to Jacinth. I have it on Selen in /storage/sdcard1/photolog.txt and a script in the same directory. Do:

sh /storage/sdcard1/jimc/pholog.sh #(wants password)

The script contains:

#!/system/bin/sh
src=/storage/sdcard1/jimc/photolog.txt
dst=jimc@jacinth.jfcarter.net:/home/images/images07/europe13/
rsync --log-format="%o %f" -t $src $dst

The #! line is useless because the SD card is mounted with the noexec option. I put in the --log-format option because I prefer the more informative format and I want confirmation that something was actually sent. The -t option is not so important for photolog.txt but is important for directories because otherwise rsync sees that the mod times do not agree and it thinks that unchanged files need to be sent over again.

Uploading Images

This description is for Selen (CyanogenMod-10 based on Android-4.1 Jelly Bean) and Mica (CyanogenMod-10.1 based on Android-4.2 Super Jelly Bean. Images that you have taken with the cellphone camera end up in /storage/sdcard0/DCIM/Camera. Naming example (case sensitive): IMG_20121221_140612.jpg which is IMG_${date}_${time}.jpg. To upload them, I copied the above pholog.sh script and made minor changes: -r to recurse into the directory, and the destination has to be …/orig/.

#!/system/bin/sh
src=/storage/sdcard0/DCIM/Camera/
dst=jimc@jacinth.jfcarter.net:/home/images/images07/europe13/orig/
rsync --log-format="%o %f" -r -t $src $dst

When importing from the camera …