The IMatch to Site system automates the addition, update and deletion of images between IMatch and this website. I created it to reduce the time taken publishing photos for others to see.

The script created Obsidian pages which are then picked up by my Quartz build.

Warning

IMatch to Site replaces IMatch to Socials.

Features

  • Uses metadata directly from the IMatch database and formats it (to my liking) for sharing with others.
  • Processes photos from a dedicated “Socials” category within IMatch and adds any new photos to the matching social platform.
  • Updates photos flagged for update.
  • Deletes photos flagged for deletion.
  • Creates album pages based photos being assigned to albums in IMatch
  • Provides alt-text for accessibility. Created using AI policy, then reviewed by me.
  • Can be run as an IMatch app for processing without leaving IMatch.

Sample image

Sample photo page (original). Show title and date photo was taken, followed by keyword categories and the image itself. Below the image is camera and shooting information, plus a map showing where the photo was taken.

Platform actions

  • Add - triggered when the IMatch attributes field for the photo is empty
    • Create multiple WebP versions of the original image at Image resolutions, overwriting any images that may already exist. Each is stuffed with basic information about the photo and copyright.
    • Create a Markdown page with:
      • Title and description (image alt-text added to description)
      • Image metadata (date taken, camera information, map)
      • Keywords
    • Add to album(s)
    • Add IMatch attributes to the image in IMatch.
  • Update - triggered when in the “_metadata” or “_update” categories
    • Same as “Add”, but with different treatment of images.
      • Metadata - Add a version if missing, or if the original has been updated since the image was created.
      • Update - Replace all images.
    • Replace Markdown page.
    • Update IMatch attributes
  • Delete - triggered when in the “_delete” category
    • Delete image files a (automatic removal from albums and groups)
    • Delete Markdown page
    • Remove IMatch attributes. Running the script again will trigger an Add.
  • Typical error conditions - mean add/update/delete won’t happen and added to appropriate category for the error
    • Missing title or keywords
    • Photo size > 25MB

Image resolutions

An image is created at multiple resolutions, consistent with Flickr’s image suffixes’. Justified Gallery, which does the thumbnail layout on gallery pages, will select an appropriate resolution for each image.

Longest side (up to)Suffix
100 px_t
240 px_m
320 px_n
500 pxnone
640 px_z
800 px_c

Installation and Configuration

Set up Code Environment

For this system to run you need:

  • Experience with code. I cannot emphasise this enough. I have taken steps to automate and bullet-proof this system as much as I can and as much as I need for my own purposes. It may not be right for you. The system modifies data and deletes data.

It is your responsibility to test how this system works for you and to support that testing with adequate backups for your needs.

Create IMatch Application Variables

To remove private information from the code, and to allow for quick changes, the system uses IMatch Application Variables for configuration.

VariableValue
imatch_to_socials_python_script_pathPath to where you have installed the code
imatch_to_socials_testing1 = test, 0 = live
quantum_hide_meA location category with the full path to my home address. If the image is in this location, a map is not displayed. (Needs to be expanded to handle multiple locations in the future.)
quantum_map_keyAPI key for the Google maps interface
quantum_pathPath to folder in your Obsidian vault that contains “/photos” and “/albums”.

There is some configuration in config.py but this is more generic.

You could move these variables to application variables if you wanted (or vice-versa).

Tying it together with media_id

Each image has a media id. For this I’m using the 6-digit global sequence from the filename.

For the Wary pelican photo, the original filename of 2025-01-25 10.56.27 [045576].dng gives a media_id of 045576.

All files, links and images are named with the media_id.

Create IMatch Attributes

IMatch Attributes are a way of attaching non-image metadata to an image within IMatch. They are stored only in the database and never saved to the image file. This system uses them to tag if a photo has been uploaded and provide some information about that.

It does not matter what the information stored is. All that matters is the existence, or not, of an attribute per platform with at least the id of the photo on the target platform.

SetNameTypeMust be UniqueDesc.
quantumpostedDateNoDate the image was uploaded
media_idTextYesUnique photo id within IMatch
urlHyperlinkYesDirect link to photo’s page

Manually Deleting

If I delete the attribute record for an image, it will be uploaded on the next run. This could cause duplicates on your platform but is useful when testing.

Create IMatch Categories

The steps are simple. Create a version of an image, and add that image to a category the script recognises and press go.

  • Socials is defined in config.py as ROOT_CATEGORY
  • The second level categories are the platforms. This must match the name given in the PlatformController subclasses’ __init__ function and be consistently used.
  • __errors is defined in config.py and has a sub-category for each error type.
  • _delete and _update are self-explanatory. Images assigned to these categories are deleted or updated. Defined in config.py
    • An image in both will cause and error. Images are removed from these categories once the action is taken. Therefore:
      • For update, an image should be in both the platform and update category
      • For delete, an image should only be in the delete category.
  • albums are the albums the image belongs to

Tag images for upload

I have a master and a JPEG version for each image. The master holds the metadata and the JPEG version is the image that will be upload.

Tag the master as the image you want to update by adding it to the root of the quantum categoy created in the previous step.

The script will find the first JPEG version for conversions, with metadata from the master.

Versions and Metadata

My location hierarchy is quite deep and runs to personal information (see Mediabank). I don’t want flickr to be creating keywords for my home address, but if the information is in the hierarchical keywords field in the uploaded file, it will so location and events information is stored in IMatch categories, outside of the keywords tree. The master image has all the keywords and versions have none.

Configure IMatch App

Advanced topic

This is an advanced topic that relies you understanding what the instructions I give below mean. It’s beyond the scope of this document to explain all the details.

The code can be run from the command line or from with IMatch using an IMatch app. Here’s how I set up mine.

  1. Close IMatch
  2. Place the GitHub code in a location of your choice. The IMatch app folder is the one we are concerned with.
  3. Create a symlink from the C:\ProgramData\photools.com\imatch6\webroot\user folder to the location of your IMatch App folder.
  4. Start IMatch. You should see the application registered.
  5. Point the imatch_to_socials_python_script_path application variable to the location where share_images.py is located.
  6. 🤞

Understanding the Code

The code is quite volatile as I change it to meet my needs. Most of the information required can be found in IMatch to Socials > Understanding the Code with specific changes listed here.

  • QuantumImage - defines an image
  • QuantumController - controls how images are manipulated and processed
  • Album - new class representing an album of photos
  • Multiple quantum-*.md files - templating the output for Obsidian
  • data.json - structure of albums, modified outside of the codebase