How to vertically align an image inside div

Demo for this question on Stack Overflow: How to vertically align an image inside div