I am looking to handle files that were uploaded by users. The main issue in that situation is that they differ in size.

How can I center an image of unknown size, both vertically and horizontally, into a div?

Thanks a lot

EDIT: I am making a thumbnail for an image. Basically, I want to keep the div to the same size, and I want the image inside that div to fit the div, but without changing the scale. I am using `overflow:hidden`

EDIT:My code is 

`<div class='pic'><img id='theimage' src='image.png'></div>` 

and my CSS is 

```
#theimage {
    vertical-align: middle;
    display: inline;

}

```