only test when string is not empty
test for images
Reformat the code