A French court has blocked the future publication of topless photos of the Duchess of Cambridge sunbathing.