"Re-add" or rescan photos to make use of EXIF data

I have uploaded several tens of GBs of photos onto my NextCloud server. The Photos app, as well as the Files app show the photos not rotated according to EXIF data, but some are 90deg off.

I noticed today that I was missing PHP exif-extension, so I installed it. Now when I upload new photos, the EXIF data is properly read and the photos show up in correct rotation.

BUT: is there a possibility to re-scan the photos somehow to make EXIF data effective for the photos which are already on the server? Or do I really need to re-upload them all to have the EXIF scanned?

I tried already

occ files:scan-app-data
occ files:scan

but these did not have any effect for the photo orientation.

You can install photoprism and use that to organize your photos. It includes support for Nextcloud. My understanding is that exif support is still in development in nc photos.

Thanks @just for the Photoprism hint. Just playing around with it a bit. How does it support Nextcloud?

I usually run Lychee on my Nextclouds as a public frontend for picture and video website for partners and customers. Lychee just imports the original nextcloud files as a folder synch and does not store the pictures or videos on its own then, just a few little previews.

Photoprism cannot read my “Library”. Is there a deeper nextcloud integration or am I missing some rights/setup details?

Hello @RoyalBlue,

The possibility to re-scan for metadata, and therefore EXIF data, is already merged for v26, and is pending merge for the next minor of v25.


Awesome news, @artonge! I’ll wait for the release then.

Try reading photoprism documentation and making some basic internet searches. This should get you started:

1 Like

Thanks for the hint @just !
I abandoned Dav a bit, since it is not really usable on Windows machines when the files are bigger than 4GB. I mostly have bigger files here, ie clips with 600Mbit. Once they are on the nextcloud, it is easy to synch them into Lychee.

I also use the Lychee web interface to hand over those files to partners, clients and other professional productions. It simply looks more beautiful and is super nice to operate and hell fast. You can import a local folder (ie /var/www/nextcloud/data/axel/files/Photos) super quick and I do not have to play around with any folder or file rights, nor with the owner (www-data). It also does not need a docker and runs in parallel to Nextcloud on the same Apache2. Simple and beautiful :slight_smile:

Still, I will try the PhotoPrism a bit, seems to have some nice features.

Nextcloud is webdav

1 Like

@just I know. But I only handle the Windows<>NC part with it.

If I use DAV for the production storages, it simply fails in Windows.


Just tried the rescan and no photos were rotated on rescan, as their rotation is still wrong when viewing in Photos app.

# sudo -u wwwrun php occ files:scan --generate-metadata --all
Starting scan for user 1 out of 3 (xxxxx)
Starting scan for user 2 out of 3 (yyyyy)
Starting scan for user 3 out of 3 (zzzzzz)

| Folders | Files | Elapsed time |
| 91      | 5261  | 00:26:25     |

Looking back at the commit [stable25] Extract GPS data from EXIF by backportbot-nextcloud · Pull Request #34535 · nextcloud/server · GitHub

To me it seems ExifProvider.php only handles GPS and image size, not the rotation. So was there even a possibility of the rotation via re-scanning to work to begin with?

Alright, so all in all, figured this out.

It boiled down to not be an actual EXIF data issue, but actually about the previews. I did not have PHP EXIF-module installed when first uploading the photos, so the preview generation did not rotate the images properly.

What I needed to do eventually was this:

  1. stop Apache2
  2. remove /appdata_*/preview/ folder (just the preview!)
  3. run: occ files:scan-app-data
  4. start Apache2
  5. (Clear the browser cache of my Nextcloud site data)

Now my preview images are in correct rotation.

(Although configured for too big size as default, so need to modify the config and run again, maybe. Or try the Previewgenerator app)