2

In my project I implemented image upload using Transloadit API, all the properties are working properly except rotation. When I hardcoded the rotation value then it is working proper and the uploaded image is rotated correctly. But when I try auto-rotation of an image by setting its rotation : true it's not working. I tried it with too many images but it looks as there was a problem in my code. Here is my code file "Index.html":

<html>
<head><title>Title</title></head>
<body>
<form action="/image/upload.php" enctype="multipart/form-data" method="POST">
  <input type="file" name="my_file" multiple="multiple" />
</form>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="https://assets.transloadit.com/js/jquery.transloadit2-v2-latest.js"></script>
<script type="text/javascript">
$(function() 
{
    $('form').transloadit(
    {
        wait: true,
        triggerUploadOnFileSelection: true,
        params: 
        {
            auth: 
            { 
                key: "MY_API_KEY" 
            }, 
            steps: 
            {
                thumb: 
                {
                    use: ":original",
                    robot: "/image/resize",
                    result: true,
                    rotation: true
                }
            }
        }
    });
});
</script>
</body>
</html>

My PHP code

<?php
$result = $_POST['transloadit'];
if (ini_get('magic_quotes_gpc') === '1') 
{
    $result = stripslashes($result);
}
$result = json_decode($result, true);
echo "<pre>";
print_r($result);
?>
4

2 回答 2

0

当您使用布尔值时,如果系统认为图像方向错误,则您可以选择旋转它,在这种情况下,可能是系统问题或您选择用于测试的图像类型有问题,要强制旋转,请使用整数值度数。

进一步查看此处的文档

于 2016-04-19T00:29:24.260 回答
0

我向 Transloadit 的支持团队问了同样的问题,最后从支持团队得到了这个答案

看起来图像包含一种格式的元旋转数据,imagemagick(还)不理解。我们很快就会有一个新版本的ImageMagick幕后花絮,它可能会解决这个问题。但我还不能给你一个确切的日期,这将在何时生效。但是,我们的自动旋转应该适用于99.9%用例。

于 2016-04-30T07:03:04.650 回答