Transloadit - 图像自动旋转不起作用
Transloadit - Image auto-rotation not working
在我的项目中,我使用 Transloadit API 实现了图像上传,除旋转外,所有属性都正常工作。当我硬编码旋转值时,它工作正常并且上传的图像正确旋转。但是当我尝试通过设置 rotation : true
来自动旋转图像时,它不起作用。我尝试了太多图像,但看起来我的代码有问题。这是我的代码文件 "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>
我的PHP代码
<?php
$result = $_POST['transloadit'];
if (ini_get('magic_quotes_gpc') === '1')
{
$result = stripslashes($result);
}
$result = json_decode($result, true);
echo "<pre>";
print_r($result);
?>
当您输入布尔值时,您是在让系统选择旋转它如果它认为图像方向错误,在这种情况下可能是系统问题或您选择用于测试的图像类型,要强制旋转,请使用整数值度数。
进一步查看 docs 此处。
我向 Transloadit 的支持团队询问了同样的问题,最终得到了支持团队的回答
看起来图像包含某种格式的元旋转数据,imagemagick
不理解(还)。我们很快就会在幕后推出 ImageMagick
的新版本,这可能会解决这个问题。但我还不能给你确切的上线日期。但是,我们的自动旋转应该适用于 99.9%
个用例。
在我的项目中,我使用 Transloadit API 实现了图像上传,除旋转外,所有属性都正常工作。当我硬编码旋转值时,它工作正常并且上传的图像正确旋转。但是当我尝试通过设置 rotation : true
来自动旋转图像时,它不起作用。我尝试了太多图像,但看起来我的代码有问题。这是我的代码文件 "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>
我的PHP代码
<?php
$result = $_POST['transloadit'];
if (ini_get('magic_quotes_gpc') === '1')
{
$result = stripslashes($result);
}
$result = json_decode($result, true);
echo "<pre>";
print_r($result);
?>
当您输入布尔值时,您是在让系统选择旋转它如果它认为图像方向错误,在这种情况下可能是系统问题或您选择用于测试的图像类型,要强制旋转,请使用整数值度数。
进一步查看 docs 此处。
我向 Transloadit 的支持团队询问了同样的问题,最终得到了支持团队的回答
看起来图像包含某种格式的元旋转数据,imagemagick
不理解(还)。我们很快就会在幕后推出 ImageMagick
的新版本,这可能会解决这个问题。但我还不能给你确切的上线日期。但是,我们的自动旋转应该适用于 99.9%
个用例。