You may want to look at exif headers which can be (but don't have to be) written inside tiff or jpg file. You'll find the appropirate function [man]exif_read_data[/man] in php manual.
You shouldn't rely on it though, because many images don't have them (exif data I mean).
Oh, and one more thing: try searching google for "php image resolution" - works miracles 😉