Fix for allowing the current cache to properly work with images which does not have the same internal format and extension (e.g. PNG internal format and .JPG extension).