Jump to content

help rotating pics!!


jwk811

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/43162-help-rotating-pics/#findComment-209679
Share on other sites

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>

Link to comment
https://forums.phpfreaks.com/topic/43162-help-rotating-pics/#findComment-211279
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.