One important thing is to assure that the thumbnail image always contains the same information as the original, only in a downscaled version. To make this possible we use the modification time stored in the 'OriginalMTime' key and compare it with the current modification time of the original:
Example 1. Algorithm to check for modification.
if (image.mtime != thumb.OriginalMTime) {
recreate_thumbnail ();
}
|
Note: It is not sufficient to do a image.mtime > thumb.OriginalMTime check. If the user moves another image over the original, where the mtime changes but is in fact lower than the thumbnail stored mtime, you won't recognize this modification.