旋转图像并保存

时间:2018-03-21 22:22:53

标签: php image rotation

我找到了一个保存图片的php脚本。 Android应用程序在渲染图像时指的是Web脚本。 但是,图像旋转90度。 难道你不知道要添加到php脚本中以将图像转到右侧吗?

php code

if (!empty($_POST)) {

$accountId = isset($_POST['accountId']) ? $_POST['accountId'] : '';
$accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : '';

$auth = new auth($dbo);

if (!$auth->authorize($accountId, $accessToken)) {

    api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
}

if (isset($_FILES['uploaded_file']['name'])) {

    $currentTime = time();
    $uploaded_file_ext = @pathinfo($_FILES['uploaded_file']['name'], PATHINFO_EXTENSION);

    if (@move_uploaded_file($_FILES['uploaded_file']['tmp_name'], "../../".TEMP_PATH."{$currentTime}.".$uploaded_file_ext)) {

        $response = array();

        $imgLib = new imglib($dbo);
        $response = $imgLib->createMyPhoto("../../".TEMP_PATH."{$currentTime}.".$uploaded_file_ext);

        if ($response['error'] === false) {

            $result = array("error" => false,
                            "originPhotoUrl" => $response['originPhotoUrl'],
                            "normalPhotoUrl" => $response['normalPhotoUrl'],
                            "previewPhotoUrl" => $response['previewPhotoUrl']);
        }

        unset($imgLib);
    }
}

echo json_encode($result);
exit;

}

感谢您的帮助

0 个答案:

没有答案