Self-consistent description of nuclear photoabsorption cross sections