test for alt attribute before assign value to img