Only generate thumbnails if needed