Restriction file sizes/dimensions on PHP upload form?

does anyone know how to restrict file dimensions on a php upload form?

the idea is for an icon/avatar directory, where u can upload an icon-- but i dont want them uploading huge pictures.

how can i restrict the file size, and more importantly, the image’s dimensions to say, 100x 100 ?