only add class, width, and height to image if corresponding data attributes exist