Q:

Dynamic backgroundimages PHP GD

Problem
Basicly, it's impossible to use a full-size photograph with the background-image in a proper way imo.
Different resolutions, wide-screen etc etc. What im looking for is a JS/PHP GD solution for this problem.
Technique
From what i hear, it would be as follows. Javascript looks up available screensize (browser window) or screenresolution. Parses this to PHP GD. On the FTP you'll have a high-res image (1600x1200 for example). The PHP GD scales this according to the information parsed by JS.
This will also have to work onResize.
Since im 'just' a simple designer, my lack of JS/PHP is killing me over this issue.
If anyone can help me out with a proper solution, i would love to friend-link them on my new site once it's finished. Thanks in advance and much love from Holland.
Phil

A:

Basicly, it's impossible to use the background-image in a proper way imo.

I know that's your opinion but the rest of the web appears to disagree with you. They make it work. But that's probably not the major issue here.
Resizing a background for every user, hell, every request if you don't cache, is going to nuke your server in a nanosecond. GD resizes are expensive and if this is on shared hosting, you'll end up having your site kicked off it. If there are other sites on the same server, they'll slow to a crawl.
Even if you can shovel enough coal into the server, it's going to make for a pretty dodgy user experience. Rather than just being able to download the file, the browser is going to have to wait while the PHP generates the image and only then can it download.
And what if I loaded this site on a large screen? I've got a possible ~3840*1200 resolution here. Even if you don't scale it up, I'll have to download the full version. A large screen size doesn't mean I have redundant optical fibres to my computer.
But, all that said, it's certainly possible. I'd recommend you start with jQuery. It makes hooking onto window -load and -resize events and changing the CSS dynamically pretty simple. The gritty details can be accomplished with a few simple googles: "php resize image", "jquery onresize" and "jquery change background".

