use javascirpt for first option ie -
var w = screen.width
var h = screen.height
(if you search around you will found loads of scripts for this, you can easily set it so that various things happen for differing screen sizes. ie different page or different frame layouts etc)
and php for image info ie
getimageinfo(IMAGE)
fine for both methods, check out the user manul for usage on getimageinfo
darren ramowski