Languages

Menu
Sites
Language
Taken photo is displayed as 90 degrees rotated to the left.

Hello , 

I have an input with type file , I use it to upload an image to server . 
When I choose an image from the gallery , it is uploaded correctly , but when I upload an image captured by camera , it's displayed as 90 degrees rotated to left .

This is the code

 


<html>

<head>
    <meta charset="utf-8" />

    <title>FamilyApp</title>

    <link rel="stylesheet" type="text/css" href="css/style.css" />     
    <script src="js/index.js"></script>
    <script src="js/main.js"></script>

<script type="text/javascript">


            function u()
            {

                var file_data = $('#sortpicture').prop('files')[0];
                // var file_data = pt;  
                var form_data = new FormData();                  
                alert(file_data.name);
                alert(file_data.path);
                form_data.append('file', file_data);
                $.ajax({
                            url: 'http://localhost/upload.php',  
                            dataType: 'text', 
                            cache: false,
                            contentType: false,
                            processData: false,
                            data: form_data,                         
                            type: 'post',
                            success: function(php_script_response){
                                var f=php_script_response;
                                sessionStorage.setItem("image",f);
                                ajout();
                            }
                 });

            }


            
function ajout()
{
      var image = sessionStorage.getItem("image");
     




      
            
              var xhr=new XMLHttpRequest();
              var url="http://localhost/addactivity.php";
              xhr.onreadystatechange=result; // dans chaque changement d'etat . la fnct result te5dem
  xhr.open("GET",url+"?image="+image,true); 
              xhr.send(null); // null car c'est une methode GET , sinon si POST n7ottou parametres


              function result()
              {
                if(  (xhr.readyState==4) && (xhr.status==200)  )   
                  {
                    alert("Activité ajoutée avec succès");
                    window.location = "a.html"; 
                  }
              }        
}



</script>
</head>


      
<body class="accueilBody" style="background-color: #eaeaea;">
   
     
      <div data-role="footer" data-position="fixed" class="btnConfirmerFooter"onclick="return u()">
           <center>  <h7> Confirmer</h7> </center>
      </div>   
         
         
         
     <center>

       Photo

<br>

<input id="sortpicture" type="file" name="sortpic"  accept="image/*" />
       
        
     </center>
    </div>
    
    
    
    
</body>

</html>

 

 

 

Responses

1 Replies
Iqbal Hossain

Hi~

I think your camera taking photo in landscape orientation.  Catch the event when user add photo using camera and then rotate the photo as per requirement. 

-Thanks