Closed Bug 875181 Opened 11 years ago Closed 11 years ago

photos taken with camera are rotated 90 degrees in gallery view

Categories

(Firefox OS Graveyard :: Gaia::Gallery, defect)

defect
Not set
critical

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 298619

People

(Reporter: jesse.ji, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17

Steps to reproduce:

launch camera app using my tara device,and take a photo in portrait mode, then launch gallery app. 


Actual results:

The photo is rotated 90 degrees


Expected results:

The photo shows in portrait mode
I have dived into the gallery/camera components in my tara branch.

As far as I known,Unagi devices immediately ratate the photos taken with camera 90 degrees and save them in media storage. But I think it's not a good way,cause that the photos copied from other devices with a non-zero orientation exif value will not show properly in gallery app.


I make some changes in "mediadb.js" (Gallery app always save files's metadata in indexed db before showing them):


      function gotMetadata(metadata) {
        fileinfo.metadata = metadata;
        if(EXIF && file.type=='image/jpeg'){
	      	  var reader = new FileReader();
			  reader.onload = function() {
				  try{
					   var oExif = EXIF.readFromBinaryString(this.result);
					   if(oExif){
					   		fileinfo.metadata.orientation=oExif.Orientation;
					   }
					   storeRecord(fileinfo);
				  }catch(e){ }
			  };
			  reader.readAsBinaryString(file);
  		}else{
  			 storeRecord(fileinfo);
  		}



changes in "media_frame.js":

MediaFrame.prototype.displayImage = function displayImage(blob, width, height,
                                                          preview,orientation)

add a parameter named with 'orientation'.

  if(orientation && orientation>0){
	  	var rotation=0;
	    switch(orientation) {
	        case 6:
	            rotation = 90;
	            break;
	        case 3:
	            rotation = 180;
	            break;
	        case 8:
	            rotation = 270;
	            break;
		 }
		 this.rotation=rotation;
  }

 then do something with the "this.rotation".


 Also we should do some work with displaying thumbnails in gallery and camera app.
 I have done the work.
Severity: normal → critical
See Also: → exif
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.