Added code to correctly set the width and height for photos.