diff --git a/_posts/2020-10-23-nextcloud-photos.md b/_posts/2020-10-23-nextcloud-photos.md index adefb30..091a464 100644 --- a/_posts/2020-10-23-nextcloud-photos.md +++ b/_posts/2020-10-23-nextcloud-photos.md @@ -89,11 +89,22 @@ First we need to fix Nextcloud's preview generation. By default, Nextcloud gener # Photo Sorting +**UPDATE 2021-01-26:** Added methods to run the script on both client and server systems. +{: .notice--info} + Nextcloud is first and foremost a file sharing application, so it views files just as your file system would. This is great until you get to photo albums, where the EXIF metadata of the photo is more relevant to sorting than the filename or modified date. To be sure that all photos in Nextcloud display in chronological order, we need to get creative. -That's where the wonderful exiftool comes in. This powerful command-line application allows you to read and manipulate the EXIF data of a photo. The feature that solves our problem is the ability to read the original capture date of a photo and apply it to both the *last modified* attribute and the *filename*. This way, no matter how you sort the images in Nextcloud, they'll display in **chronological** order. +That's where the wonderful exiftool comes in. This powerful command-line application allows you to read and manipulate the EXIF data of a photo. The feature that solves our problem is the ability to read the original capture date of a photo and apply it to both the *last modified* attribute and the *filename*. This way, no matter how you sort the images in Nextcloud, they'll display in **chronological** order. -To get started using exiftool, follow the instrutions below on one of your **Nextcloud clients.** +You have **two options** for using exiftool: + +1. Run a script from a synced **client** computer. + +2. Run a script on the data directory on the **server**. + +The advantage of running it on the server is that you can automate periodic scans of your photos so they are always sorted properly and up-to-date. The disadvantage is that there are some extra steps involved that may take a long time depending on the speed of your server. + +To get started using exiftool, follow the instructions below on one of your **Nextcloud clients.** ### Write the script @@ -109,17 +120,53 @@ To get started using exiftool, follow the instrutions below on one of your **Nex sudo nano photo-cleanup.sh ``` + **Option 1: Client Script:** + ```shell #!/bin/sh albumdir=$1 + # use below variables if running on the server + # nextclouddir="/var/www/nextcloud" + # user who owns the photos + # nextclouduser="" + echo "Changing modified date to shot date..." exiftool "-filemodifydate