Image appearing 90 degree tilt when downloaded from server in Android?

Viewed 2196

Working on an application in which we capture images and upload over server. Application is in Android And I Phone. When we post image from Android, they are of quantity in Kilo Bytes but when we Post image from I Phone they are of MB size.

When we the images posted from IPHONE 5 with URL on browser, they appear good as they supposed to appear but when we download that image in Android device and show in an IMAGE VIEW, they appears 90 deg tilt to the left hand side.

I am not using, any rotation code after downloading the images in Android or in I Phone.

In I Phone the images are appearing fine.

IMages captured from Android are also visible straight. Images of low resolution capture from I Phone are also visible straight in Android.

Image uploaded from Android:

https://s3.amazonaws.com/WeddingApp/Weddingimage/933_6_stan.jpg

Image uploaded from I Phone:

https://s3.amazonaws.com/WeddingApp/Weddingimage/937_6_stan.jpg


public static boolean downloadFile(final String fileURL,File directory,Context CONTEXT){
        try{
            URL url = new URL(fileURL);

            URLConnection ucon = url.openConnection();
            ucon.setReadTimeout(35000);
            ucon.setConnectTimeout(10000);

            InputStream is = ucon.getInputStream();
            BufferedInputStream inStream = new BufferedInputStream(is, 1024 * 5);

            File file = directory;

            if (file.exists())
            {
                file.delete();
            }
            file.createNewFile();

            FileOutputStream outStream = new FileOutputStream(file);
            byte[] buff = new byte[5 * 1024];

            int len;
            while ((len = inStream.read(buff)) != -1)
            {
                outStream.write(buff, 0, len);
            }

            outStream.flush();
            outStream.close();
            inStream.close();

        }
        catch (IOException e){  //IF SDCARD NOT EXIST THEN PASS RESPONSE TRUE`  
            e.printStackTrace();
            return false;
        }catch(Exception e){
            e.printStackTrace();
            return false;
        }

        return true;
    } 

Please suggest me.

2 Answers
Related