you can get the dimensions in pixels using getimagesize() function. Now convert it into any unit you want.
Note: The length in cm will vary from monitor to monitor. Suppose you have and image of 10 pixels. viewing it at 800x600 on 14" and 17" monitor will yeild length of picture in cm to be different for both the monitors, hence you should avoid using units like this.