How do I make sure that when I resize the picture, it doesn't move to the other side?

So I have this problem that when I want to resize an image, it shifts to the left, so it goes beyond the border. Here: