add image files, update index and logic

fix syntax error in if statement