Well, horizontal rays go through the lens and then are bent towards each other. If you're close enough to the lens the rays are still the right way round but form a smaller image; if you're far away enough from the lens the rays meet and then cross over and so they will be upside down.