typo3typo3-9.x

TYPO3 get all Images without References


It seems not possible to use the Filelist Module to get a list of all unused images (I mean all images without references). I checked the extensions, but it seems there is no Extension for this task. What are possible solutions to this?

Thanks


Solution

  • One way would be a SQL query. In a very simple example it could look like this:

    SELECT * FROM sys_file WHERE uid NOT IN (SELECT uid_local FROM sys_file_reference)
    

    Each "used" file should have an entry in the sys_file_reference table. So, every file (sys_file-record) with no occurrence in sys_file_reference should be unused.

    Be careful! Besides references to single files, files can be in use via folders. The query above does not check these uses.