note 97193 deleted from function.imagerotate by danbrown

From: Date: Wed, 07 Apr 2010 19:13:22 +0000
Subject: note 97193 deleted from function.imagerotate by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-167960@lists.php.net to get a copy of this message
Note Submitter: elvios at gmail dot com dot com ---- Alteration to kmrohe's function, so it rotates both 90 degrees CW and CCW. <?php function KmroheRotate($image, $rotation) { $width = imagesx($image); $height = imagesy($image); $newimage = imagecreatetruecolor($height, $width); imagealphablending($newimage, false); imagesavealpha($newimage, true); for ( $w=0; $w<$width; $w++) for ( $h = 0 ; $h<$height ; $h++) { $reference = imagecolorat($image, $w, $h); if ( $rotation == "90" ) { imagesetpixel($newimage, $h, ($width - 1) - $w, $reference); } else { imagesetpixel($newimage, ($height - 1) - $h, $w, $reference); } } return $newimage; } ?>

« previous php.notes (#167960) next »