Find all pages from images? (to cleanup unused images)

I would very much like to know how to find out about an image, on which page it is used.

The background is: Over time, there are more than 1,000 images laying around in a Kirby site.

I use a files-section in the site.xml to display all these images (using k3-filesdisplay-section plugin from @texnixe). This works great.

However, now I want to know for each image on which page it is used. Otherwise you can’t clean up and delete an image - because the image would be missing on the corresponding page.

From my point of view i think that you should be able to see the corresponding pages in the template of the image.

Is there a solution for this, or another idea? Somehow we would like to clean up, because it can not go on like this. There are hundreds of unused images in the directory and the overview is unfortunately lost.

In general this is possible but if it is easy to achieve or not depends on how images are used across your site.

For example, do you have a central place where you store your images? Or are images always tied to pages and not used anywhere else?

Do you already use file uuids?

I proposed a per-page solution recently that could also be used across the site. Trying to find it again…

This only works for files that are stored somewhere in the content, not for files used indirectly your templates, and theses might often be thumbs, which would complicate the whole thing.

I would probably use Screaming Frog which will crawl the site and give you a list of the images actually being used on the front end. you can export this as a spread sheet and then just work down the list manually deleteing the ones that are not on the list from the file system.