Sync media entities from files

I think I’m onto something that could be hot for photographing drupalists. 🙂

For some years I have been using Koken to publish galleries directly from Lightroom (LR). This is easy and fast. But because my website is based on Drupal, I have two island systems:  Website and galleries. I think this is suboptimal.

I would like to be able to export images directly from LR to Drupal and maintain my own image database.

Achieved so far:

  • Export-Preset in LR, which with the help of Jeffrey Friedl’s amazing plugin ‘Run Any Command’ (http://regex.info/blog/lightroom-goodies/run-any-command) automatically generates a myImage.yml file with metadata for each exported myImage.jpg:
    filename: "myImage.jpg"
    lightroom-uuid: "43CD9A97-05ED-463A-A0F2-31182C5FAB5E"
    caption: ""
    keywords: "Alpstein, Altmann, Appenzell, Berg, Berge, Fälenalp, Orte, Schweiz, Zwinglipass, mountain, mountains"
    captured: "2013-07-17T17:42:55.00"
    shutterspeed: "¹⁄₁₆₀₀ Sek."
    aperture: "f/5.6"
    iso: "100"
    focallength: "100 mm"
    croppedwidth: "3840"
    croppedheight: "3840"
    megapixels: 14.7 MP
    aspectratio: "quadrat"
  • Synchronize images and ymls to the server via FTP or rsync.
  • missing step (see below)
  • Display image stock in a view.

To do:

  • Drupal: Automatic import that searches through the sync folder, creates a media entity for each image and populates the fields with the metadata from the yml.
  • Use Lightrooms Image-UUID (in yml) to detect and update changed images (image or metadata).
  • Detect deleted images and delete the corresponding media entity.

Tried and tested so far:

  • Creation of nodes using ReST-API. This would remotely control the entire functionality.
    Pro: Relief of the web server
    Con: Additional step in the process.  Difficult to implement – at least with my knowledge. 🙂

I would rather have a solution via a custom module, which e.g. checks the image stock via cronjob and keeps the media entities up to date.

Any help or advice is very welcome.
Best regards Patrick

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/22/feed