how to set the background image property of a div to a dynamically generated image

Posted by tixrus on Stack Overflow See other posts from Stack Overflow or by tixrus
Published on 2010-05-03T16:53:56Z Indexed on 2010/05/03 16:58 UTC
Read the original article Hit count: 390

Filed under:
|
|
|

I have some divs and each one has its own background image. The base images as stored is just a black silhouette.

What I would like to do is use the PHP GD package to modify the color of those images somewhat randomly and have the modified randomly coloured images be the background images of the divs.

One way to do it is just create GD images structures from the original files, modify them, save the results as a temp file, pass this filename into the client, and then use jquery to modify the css background image properties of the divs to be the new file. But this is going to leave a lot of files laying around to garbage collect.

Is there some way to do it without creating a bunch of files?

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery