Deleting Thumbnails

The deletion of a thumbnail is somehow tricky. A general rule is that a thumbnail should be deleted if the orginial file doesn't exist anymore (Note: If it was only modified the thumbnail should be recreated instead). There are different ways how this can be achieved:

  1. If a filemanger is aware of this standard and deletes a file it could take care of deleting the thumbnail too.

  2. A daemon runs in the background which cleans up the cache in certain intervalls.

  3. The user can call a managing tool which lists all the thumbnails together with their original file paths. From there he can delete single images, all images where the orignial doesn't exist anymore or all images older than eg. 30 days.

Another problem is that there are some URI schemes where it isn't directly possible to determine if the file exists or not. Eg. this applies to all the internet related schemes like http:, ftp: and so on when you don't have an internet connection. The same applies to removable media eg. a cdrom.

The above mentioned managing tools should therefore consider the following rules:

  1. If the URI scheme specifies a local file (like the file: scheme) then it should check if the original file exists. If it doesn't exist anymore the program should delete the thumbnail.

  2. For all internet related schemes (like http: or ftp:) delete the thumbnail if it hasn't been accessed within a certain user defined time period (can default to 30 days).

  3. Removable medias should be considered too. Although this can't work for all systems in all cases reliable there are some heuristics which can be used. Eg. checking the fstab configuration file and look for the mount point of /dev/fd0 (floppy disk) or check if the CD-Rom drive is mounted under /cdrom. Thumbnails for removable media files should be handled as in the previous point.