I guess what you're doing (screen resolution?) ...
Your javascript will EITHER have to reload some page sending the data via querystring (script.php?width=123&height=234) - look at location in the javascript reference.
OR, you can set a cookie with javascript. cookies can be read by php scripts, too.
(setcookie functions)
browse through the javascript object reference a bit.