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);
?>
Ankur Tiwari
  • 2,762
  • 2
  • 23
  • 40
  • Please setup a proper question with an explanation, where your problem is, what works, what does not... Code snippets are good, however, please don't just say: "Here is all of my code, please debug." – Pinke Helga Apr 15 '16 at 12:08
  • Hey @Quasimodo'sclone, I edited my question – Ankur Tiwari Apr 15 '16 at 13:39
  • Well done! It looks much clearer to supporters and anybody running into a similar problem will be able to find your question. :) That's what SO is for. I'll provide some edit on your question to correct minor typing error. – Pinke Helga Apr 15 '16 at 14:11
  • Thanks @Quasimodo'sclone – Ankur Tiwari Apr 30 '16 at 06:59

2 Answers2

0

When you the boolean value, you are giving the choice to the system to rotate it if it believes that the image is in the wrong direction, in this case it might be an issue with the system or the kind of images you chose for testing, to enforce the rotation, use integer value degrees.

Take a further look at the docs here.

Kiloreux
  • 2,220
  • 1
  • 17
  • 24
0

I asked the same question with the support team of Transloadit and finally got this answer from the support team

It looks like the image contains the meta rotation data in a format, that imagemagick does not understand (yet). We'll soon have a new version of ImageMagick behind the scenes, which might fix this. But I cannot give you an exact date yet of when this will be live. However, our auto-rotation should work in 99.9% of the use cases.

Ankur Tiwari
  • 2,762
  • 2
  • 23
  • 40