Added checking for images and text.

Added code to check for the existence images and text.