', $file['name'], $file['type'], $file['tmp_name'], $file['error'], $file['size']);
if (!$file['error']) {
//Success
if(end(explode(".", strtolower($file['name']))) == 'jpg') {
process($file);
} else {
printf("Invalid file type " . $file['name']);
}
}
exit;
}
function process($file) {
$original = 'input.jpg';
$rotated = 'output.jpg';
if(move_uploaded_file($file['tmp_name'], $original)) {
print("
input.jpg uploaded successfully");
} else {
print("A problem occured moving " . $file['tmp_name'] . " to $original");
return false;
}
$imginfo = getimagesize($original);
$pic_width = $imginfo[0];
$pic_height = $imginfo[1];
print "
Dimensions are $pic_width x $pic_height";
$image = imagecreatefromjpeg($original);
//$rotation = imagerotate($image, 270, 0);
$rotation = imagerotate($image, -90, 0);
$pic_width = imagesx($rotation);
$pic_height = imagesy($rotation);
print "
Dimensions of rotation are $pic_width x $pic_height";
imagejpeg($rotation, $rotated);
print "
";
print "
";
}
?>