Rings Gallery Image Processing

Loading pictures

ring-load

This script is intended to be run interactively and as since does very little other than queue a group of images for processing. The images should be group into a directory and the directory copied into the input directory for the ring instance. The input directory is unique to a ring instance and is defined in the ring configuration file. The input directories on a ring host can be examine with the command remctl <ring host> show.

The ring-load script takes a directory in the input directory and creates an entry in the picture_upload_queue table in the instance database. The entry is marked PENDING.

ring-load-daemon

This script is intended to be run as a daemon started by systemd. Queued entries are read from the picture_upload_queue with a status of PENDING. For file in the queued directory images files are selected for processing. Image files are identified by the file extension and the list of valid extensions are defined in the picture_types table.

  1. The file name is parsed into a "picture lot" by removing the configured input directory root and the file name.
  2. The lot is normalized by removing leading and trailing slashes.
  3. ImageMagick is used to generate a signature, an ahash, a dhash, and ahash.
  4. The signature is used to search the rings database for duplicate images. By default duplicates are ignored.
  5. A unique picture id is generated.
  6. A directory is created to hold the raw, unprocessed image.
  7. The input image is copied into the raw directory using the PID as the file name.
  8. Meta data for the raw image is extracted and store in the pictures_information table.
  9. The signature and hashes for the input image are stored in the picture_input_index table.
  10. Create a picture_details entry for the raw image.
  11. A SIZE action is entered in the picture_action_queue table.

This script can also be run as a stand alone script for testing using the --one-shot switch.

ring-daemon

The ring-daemon script is intended to be run as a daemon started by systemd. The script reads entries in the picture_action_queue and performs the requested actions. Valid actions are:

  • 180 - rotate the image 180 degrees
  • LEFT - rotate the image 90 degrees counter clockwise
  • RIGHT - rotate the image 90 degrees clockwise
  • SIZE - generate/regenerate the supported image resolutions. Supported image resultions are defined in the picture_sizes table.
  • INFO - Regenerate the metadata for an image.

Tasks

  • Re-create a get/store metadata routine
  • Update both ring-load-daemon and ring-daeom with new routine