Use PHP imagecreatefromgif() to modify the right 150 pixels of a 760x1 pixel gif image -
I have a 1 pixel length with 760 pixels wide image that I use as a repeating vertical background image The right side of this image is filled with spots (the left side of the image is white).
The purpose of this background image, in my CSS based layout, is that it is the illusion that the sidebar background color runs all the way down the page (what is easy to do with tables, but with CSS positioning Not so much).
What do I have to do is create a php script (background-image.php) which has the Image CreativeFormFunction, a hex number and use it to redraw the spot color of the image to match that spot color And on which the resulting image is saved on the server, overwriting the default.
Ideally, I do not want to call template load at all times to this function, and when the user chooses to change the template colors, so once they do this, I just exist on the server I would like to revise the image that will always be called "sidebar_big.gif"
Any ideas on how to do this have been highly appreciated.
Something like this can be done:
$ token = MD 5 (Serialize (array ($ red, $ green, $ blue))); If (! File_exists ('cachedir /'. $ Token '.gif')) {$ img = imagecreatefromgif ('origfilename.gif'); $ Color = imagecolorallocate ($ img, $ red, $ green, $ blue); {Imagesetpixel ($ img, $ i, 0, $ color) for ($ I = $ startPixel-1; $ i & lt; $ endPixel; $ i ++); } Imagegif ($ img, 'cachedir /'. $ Token '. Gif'); } Service file ($ token);
Edit : Caching was added to the example code
Comments
Post a Comment