loop around if on last image (or first)