I was actually sitting slightly behind Ian McKellen and Ian McKellen sat slightly ahead of us and the camera was placed in such a way that it looked like we were sitting side by side with him taller than I. You’d look at the monitor and you’d see us sitting next to one another and he was tall and I was small.
A good example of that would be Frodo and Gandalf in the cart at Bag’s End in the first film.
Frodo jumps into the cart and they’re sitting side by side.
Elijah Wood Answers the Web's Most Searched Questions | WIRED