Can I rotate a image using a php code? Help needed with the php code?

Member Avatar for diafol

GD library:

From the manual:

<?php
// File and rotation
$filename = 'test.jpg';
$degrees = 180;

// Content type
header('Content-type: image/jpeg');

// Load
$source = imagecreatefromjpeg($filename);

// Rotate
$rotate = imagerotate($source, $degrees, 0);

// Output
imagejpeg($rotate);
?>

http://php.net/manual/en/function.imagerotate.php

You need the php.net manual. Download a copy - it'll save you hours of pointless forum posting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.