public function rotateImageNDegrees($degrees)
{
if (!is_numeric($degrees)) {
throw new InvalidArgumentException('$degrees must be numeric');
}
if (!function_exists('imagerotate')) {
throw new RuntimeException('Your version of GD does not support image rotation.');
}
$this->workingImage = imagerotate($this->oldImage, $degrees, 0);
$newWidth = $this->currentDimensions['height'];
$newHeight = $this->currentDimensions['width'];
$this->oldImage = $this->workingImage;
$this->currentDimensions['width'] = $newWidth;
$this->currentDimensions['height'] = $newHeight;
return $this;
}