Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

photos rotating

$
0
0

HI, I was working on a project where users could upload photos. I am using the imagefactory module

var ImageFactory = require('ti.imagefactory');
 
    Upload_pic.addEventListener('click', function (e){
 
        Upload_pic.setImage('/images/uploadPhoto2.png');
        Titanium.Media.openPhotoGallery({
            success: function(e){
                ImageUploaded=true;
                console.log("typeof e.media --------  " + e.media);
                ImageView=Ti.UI.createImageView({
                    image:e.media
                });
 
                ImageViewvar=ImageView.toBlob();         
                ImageViewResized = ImageFactory.imageAsResized(ImageViewvar, { width:500, height:500 });
            },
            error: function(e){
                Upload_pic.setImage('/images/uploadPhoto1.png');
 
                //alert("Error accessing photos");
            },
            cancel: function(e){
 
            Upload_pic.setImage('/images/uploadPhoto1.png');
 
                //alert("Gallery was cancelled");
            },
            alowEditing:true,
            mediaType:[Titanium.Media.MEDIA_TYPE_PHOTO]
        });
    });
I noticed a couple of times that the images were being rotated when returned back from my webservice at a later stage. Then I realised that the issue arose because the user had rotated the photo on their phone and saved it that way but, when titanium grabbed the image, it grabbed the original image, which had been changed AND saved by the user before uploading.

Is there any way I can detect in the code if the image was rotated and thus do the same rotating myself before upload? I've looked around but haven't spotted anything on this.

It's happening on Android, I haven't tested on iOS yet. Any help appreciated


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>