Rotate an image in PHP

Description

The following code shows how to rotate an image.

Example


<?php/*from  ww w  .  j  ava2  s  .  com*/
    $image = imagecreatefrompng("test.png");
    $hotpink = imagecolorallocate($image, 255, 110, 221);
    $rotated_image = imagerotate($image, 50, $hotpink);

    header("content-type: image/png");
    imagepng($rotated_image);
    imagedestroy($image);
    imagedestroy($rotated_image);
?>

The code above generates the following result.

Rotate an image in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text