Control of the optically induced heating of gold nanoparticles