modified to use images if attribute present