Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imagerotate

Description

The imagerotate of Image for PHP rotate an image with a given angle.

Syntax

imagerotate(
    GdImage $image,
    float $angle,
    int $color
): GdImage|false

Parameters

image

A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().

angle

Rotation angle, in degrees. The rotation angle is interpreted as the number of degrees to rotate the image anticlockwise.

color

Specifies the color of the uncovered zone after the rotation

Return

Returns an image object for the rotated image, or false on failure.

Examples

1 · return

<?

$width = 100;
$height = 100;
$image = imagecreate($width, $height);

$red = 255;
$green = 255;
$blue = 255;
$color = imagecolorallocate($image, $red, $green, $blue);

$angle = 45;

$return = imagerotate($image, $angle, $color);

var_dump($return);

?>
object(GdImage)#2 (0) {
}

2 · base64

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/png/Happy.png';
$image = imagecreatefrompng($filename);

$red = 255;
$green = 255;
$blue = 255;
$color = imagecolorallocate($image, $red, $green, $blue);

$angle = 45;
$image = imagerotate($image, $angle, $color);

ob_start();

    imagepng($image);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,' . base64_encode($output) . '">
</body>
</html>';

?>
<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI4AAACOCAYAAADn/TAIAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAS+ElEQVR4nO2de3Bb1Z3HP75RtIpwXZMYxZgQggHHZENIPW6g5eWmdDtUgZJZAiwDocNSUh4bupQlW8DJrLMt22aykMIUQofpQKBDAi2vNXQH6BimpDCkJg8vIRQS4ziJMI4xxg/hyPrtH0eKZSPL0r3n6l49vjNnFMW65/6u7kfnnvM75/x+JSIiFJVM/UCp00a4VYbTBrhUXcC3gDVOG+JWeZw2wIXqAoLAtlgB+A/nzHGnii3OWCVCE1cTxZbnSyqCM6pk0MRVhGeciuAopYImriI8CSqCkx40cRXhianQwckEmriK8FDY4JiBJq6Ch6dQwbECTVwFDU8hg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