jwk811 Posted March 17, 2007 Share Posted March 17, 2007 how can i rotate pics????? Quote Link to comment Share on other sites More sharing options...
ldsmike88 Posted March 18, 2007 Share Posted March 18, 2007 Use PHP: <?php function rotateImage(){ // The file you are rotating $image = 'http://assets.espn.go.com/i/ncaa/07mens_bracket.gif'; //How many degrees you wish to rotate $degrees = -90; // This sets the image type to .jpg but can be changed to png or gif header('Content-type: image/gif') ; // Create the canvas $source = imagecreatefromgif($image) ; // Rotates the image $rotate = imagerotate($source, $degrees, 0) ; // This shows the the image imagegif($rotate); //or // This saves the image //imagegif($rotate, 'NCAABracket.gif'); } echo rotateImage(); ?> If you are rotating a JPG or PNG just change all the gif accordingly. Quote Link to comment Share on other sites More sharing options...
fenway Posted March 20, 2007 Share Posted March 20, 2007 Alternatively, you can simply change the src via JS. Quote Link to comment Share on other sites More sharing options...
alexcmm Posted March 20, 2007 Share Posted March 20, 2007 Here's the javascript I use: <SCRIPT LANGUAGE="JavaScript"> <!-- Begin // Set up the image files to be used. var theImages = new Array() // do not change this // To add more image files, continue with the // pattern below, adding to the array. theImages[0] = '../images/pic1.jpg' theImages[1] = '../images/pic2.jpg' theImages[2] = '../images/pic3.jpg' theImages[3] = '../images/pic4.jpg' theImages[4] = '../images/pic5.jpg' // do not edit anything below this line var j = 0 var p = theImages.length; var preBuffer = new Array() for (i = 0; i < p; i++){ preBuffer[i] = new Image() preBuffer[i].src = theImages[i] } var whichImage = Math.round(Math.random()*(p-1)); function showImage(){ document.write('<img src="'+theImages[whichImage]+'">'); } // End --> </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.