JBZoo\Image\Filter::rotate PHP Method

rotate() public static method

Rotate an image
public static rotate ( resource $image, integer $angle, string | array $bgColor = '#000000' ) : resource
$image resource Image GD resource
$angle integer -360 < x < 360
$bgColor string | array Hex color string, array(red, green, blue) or array(red, green, blue, alpha). Where red, green, blue - integers 0-255, alpha - integer 0-127
return resource
    public static function rotate($image, $angle, $bgColor = '#000000')
    {
        // Perform the rotation
        $angle = Helper::rotate($angle);
        $rgba = Helper::normalizeColor($bgColor);
        $bgColor = imagecolorallocatealpha($image, $rgba[0], $rgba[1], $rgba[2], $rgba[3]);
        $newImage = imagerotate($image, -$angle, $bgColor);
        Helper::addAlpha($newImage);
        return $newImage;
    }