Forum Moderators: coopster

Message Too Old, No Replies

Change 2 Color GIF image with PHP and Javascript

Hope This Makes Sense

         

Daigenin

4:06 am on Feb 22, 2003 (gmt 0)



I have a two color gif image and I want to replace one of the paletted colors in this image by clicking on some sort of button (using onmouseclick, or what not). Do I need PHP Image manipulating functions at all? If I do, how do I call the PHP code (which I thik is imagecolorallocate) from the javascript onmouseclick?

hakre

7:05 am on Feb 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi Daigenin,

you will defenetly need to use php for this. to have your php called, the javascript has to change the location of the document or you can do this with a form/submit.

let me give you one example: create a form, place the button as an image input element into it and set the forms' action to your php script. then if the user clicks on that button-image, the form will be submitted and your php can change the image. voila.

c3oc3o

11:59 am on Feb 22, 2003 (gmt 0)

10+ Year Member



If it's just one color you need to replace, you may want to consider making the color you need to replace transparent, and putting the image in a <div> whose background color (which is visible through the transparency) you can change easily in JS, without any server-side scripting...