10. Shared Thumbnail repositories

In some situations it is desirable to have a shared thumbnail repository. This is a read-only collection of thumbnails that is shared among different users or different computers. For example a CD-ROM with images, could include the thumbnails for these images such that they do not need to be generated for every user or computer accessing this CD-ROM.

Because the URI of such an image is not constant (a CD-ROM for example can be mounted at different locations) the thumbnails should be in a relative path from the original image.

The location for shared thumbnails will be

.sh_thumbnails/

Within this directory are the same subdirectories as in the global thumbnail directory.

.sh_thumbnails/
   .sh_thumbnails/normal/
   .sh_thumbnails/large/
   .sh_thumbnails/fail/
   

The meaning of these directories is identical to their meaning in the global directory.

The filename of the thumbnail is also in the shared thumbnail repository the md5sum of the URI. But, because the URI is possibly not constant, only the filename part of the URI should be used, no directory parts.

10.1. Creating thumbnails in a shared thumbnail repository

A shared thumbnail repository should be considered read-only. A program should never add or update a thumbnail in the shared thumbnail repository. Such a repository should only be created on special request by the user. If a thumbnail is outdated or corrupt, a program should create a new thumbnail in the personal thubmnail repository, and not update the shared thumbnail repository.

If the user specific requested the creation of a shared thumbnail repository, the thumbnails can be created. Because the URI for shared images is possibly not constant, this means that the full URI can not be stored in the thumbnail. The URI field should, therefore, contain only the filename, and no directory parts. All other properties, however, should be the same as in the personal repository, including the size. The permissions for shared thumbnails should be the same as their original images.

10.2. Loading thumbnails from a shared thumbnail repository

When loading thumbnails from a shared thumbnail repository, the personal repository has a higher priority. If a thumbnail exists in the personal thumbnail repository, this thumbnail should be used, and not the thumbnail from the shared repository.

There is one exception to this rule. If the thumbnail in the personal thumbnail repository is outdated or corrupt, the thumbnail from the shared repository should be checked. If this thumbnail is correct, the thumbnail in the personal repository can be deleted and the thumbnail from the shared collection can be used.