attachment image conditional logic