How to render a background image correctly? I have followed this tutorial:https://www.youtube.com/watch?v=ua7K4HvbfzA

And everything looks great in rendered view. But when I rendered image, it rendered the object first but put the background image in front of the object in the end. So what I could see after rendered image was the background image. Does anyone know what I ignored or what happened?
My guess would be that You missed to check the "transparent" checkbox under "film" in the "render" tab. Furthermore, You, perhaps, have switched the inputs in the "alpha over" node. See image to find critical settings marked with red circles.