Photon strength in spherical and deformed heavy nuclei