Page 1 of 1

PHP rotate image

Posted: Thu Oct 27, 2005 2:46 pm
by ra
How would I use 3 buttons to rotate an image in the same space?

BUTTON 1 BUTTON 2 BUTTON 3

<image1, 2, or 3 based on the click.>

Is this even possible?

Posted: Thu Oct 27, 2005 2:55 pm
by feyd
live on a page, you store the already rotated images in something like Javascript. If you want server interaction (which is where php would get involved) you would use GD to rotate the image data.

Posted: Thu Oct 27, 2005 3:08 pm
by ra
know where i could find examples of the javascript that does this?

Posted: Thu Oct 27, 2005 3:10 pm
by feyd
it'd be just like Javascript rollover code

Code: Select all

var images = new Array();
images[0] = new Image();
images[0].src = 'zeroDegrees.gif';
images[1] = new Image();
images[1].src = 'nintyDegrees.gif';
images[2] = new Image();
images[2].src = 'oneEightyDegrees.gif';
images[3] = new Image();
images[3].src = 'twoSeventyDegrees.gif';

---------

onclick="someObj.src = images[2].src;"