And since Javascript could then load the correct URL based on the resolution, you're pretty much looking at a purely Javascript solution.
If you really wanted to complicate things a bit, you could have JS grab the screen resolution and send that back to a PHP script which would output the correct image, ex. creating a new Image in Javascript, pointing its source to mysite.com/image.php?res_h=1024&res_w=768, and then attach it to some element inside your HTML document.