ImageRotate() Rotating Image by GD

imagerotate($source_image,$angle,$bg_color,$int_transparent)
$source_image : Image resource created before
$angle: Rotational angle in degree
$bg_color: Color of the uncovered zone after rotation
$int_transparent: Transparent colors are ignored if value is given and not 0

Example

<?Php
header ("Content-type: image/jpg");

$file_name='../images/top2.jpg'; // Image collected
$angle='180';    // Angle of rotation is set
$img_source = imagecreatefromjpeg($file_name); // Image created

$img_rotated = imagerotate($img_source, $angle, 0); // Rotate the image

imagejpeg($img_rotated); // Output Displayed

imagedestroy($img_source);  // Free the memory 
imagedestroy($img_rotated); // Free the memory
?>
Above code is saved as gd-imagerotate-demo.php and displayed in this page, HTML code is here.
<img src=gd-imagerotate-demo.php>

GD functions

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    GD functions in PHP for handling images & graphics

    How to check GD support in PHP
    Header for an image in browser
    Drawing of graphic lines using GD
    Plotting line graph by drawing data from table
    Adding vertical grid to line graph
    Adding rectangles using imagerectangle()
    Imagearc drawing arc and circle
    Imagefilledarc drawing filled arc and circle
    Resizing and adding border to Images
    Script for Watermarking image on the fly using PHP GD
    Generate image by using user input form data

    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2021 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer