← Back
Editing: processform.php
<?php function rotateAndSave ($imgfile, $degrees) { $degrees = 360 - $degrees; // The file you are rotating $image = $imgfile; // Create the canvas $source = imagecreatefromjpeg($image) ; // Rotates the image $rotate = imagerotate($source, $degrees, 0) ; // Outputs a jpg image, you could change this to gif or png if needed imagejpeg($rotate, $imgfile, 90); } //print_r($_POST); $count = $_POST['imCounter']; for ($i=1; $i<=$count; $i++) { $rotateby = $_POST['imgRotation' . $i]; if($rotateby > 0) { $actualFileName = 'images/'.$_POST['description'.$i]; rotateAndSave ($actualFileName, $rotateby); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Advanced demo</title> <meta http-equiv="content-language" content="en" /> </head> <body> <div id="allbox"> <?php for( $j=1; $j<=$count; $j++) { echo "<img src=\"images/".$_POST['description'.$j]."\" /> <p>Nome: ". $_POST['description'.$j]."</p> <p>Ruotata di: ". $_POST['imgRotation'.$j]."</p>"; } ?> </div> </body> </html>
Save File
Cancel