Normal core php input file upload image rotate same degree static or dynamicly image rotate and showing the image original image and rotate image separate image local disk folder move.
Code:
Output Screen
Code:
<html>
<body>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="image" />
<input type="submit" name="rotate" value="rotate" />
</form>
<?php
if(isset($_POST['rotate']))
{
$image=$_FILES['image']['name'];
$tmp_name=$_FILES["image"]["tmp_name"];
$location='image/';
echo $image;
move_uploaded_file($tmp_name,$location.$image);
$imagename = "image/".$image;
$source= imagecreatefromjpeg($imagename);
$rotate=imagerotate($source,75,0);
imagejpeg($rotate,"rotated/$image");
}
if(isset($_FILES['image']['name']))
{
?>
<html>
<table>
<tr><td>UploadImage</td>
<td height="500px" width="500px" align="center">
<img src="image/<?php echo $image;?>" width="300px" height="300px" />
</td>
<td>RotateImage</td>
<td headers="500px" width="500px" align="center"><img src="rotated/<?php echo $image?>" width="300px" height="300px" /></td></tr>
</table>
</html>
<?php
}
?>
<body>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="image" />
<input type="submit" name="rotate" value="rotate" />
</form>
<?php
if(isset($_POST['rotate']))
{
$image=$_FILES['image']['name'];
$tmp_name=$_FILES["image"]["tmp_name"];
$location='image/';
echo $image;
move_uploaded_file($tmp_name,$location.$image);
$imagename = "image/".$image;
$source= imagecreatefromjpeg($imagename);
$rotate=imagerotate($source,75,0);
imagejpeg($rotate,"rotated/$image");
}
if(isset($_FILES['image']['name']))
{
?>
<html>
<table>
<tr><td>UploadImage</td>
<td height="500px" width="500px" align="center">
<img src="image/<?php echo $image;?>" width="300px" height="300px" />
</td>
<td>RotateImage</td>
<td headers="500px" width="500px" align="center"><img src="rotated/<?php echo $image?>" width="300px" height="300px" /></td></tr>
</table>
</html>
<?php
}
?>
Output Screen