func for buildthumbnails