Tweaked photo gallery script

Made it more robust by making it more tolerant with buildings that have
an image.