cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Sim (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CB-4525) IOS getPicture FileTransfer adds empty enter top of file corrupting image
Date Mon, 12 Aug 2013 20:54:47 GMT

     [ https://issues.apache.org/jira/browse/CB-4525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

John Sim resolved CB-4525.
--------------------------

       Resolution: Fixed
    Fix Version/s: 2.9.0

Wasn't an issue with cordova.
Bug was with service item uploaded to.
                
> IOS getPicture FileTransfer adds empty enter top of file corrupting image
> -------------------------------------------------------------------------
>
>                 Key: CB-4525
>                 URL: https://issues.apache.org/jira/browse/CB-4525
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 2.9.0
>         Environment: IOS, IPAD 6.x
>            Reporter: John Sim
>            Assignee: Shazron Abdullah
>              Labels: test
>             Fix For: 2.9.0
>
>
> On the ipad I take a photo and transfer that photo to a webservice via phonegap upload.
> The photo appears to have an extra carriage return at the very top of the file when editing
in notepad++ image.jpg and also png files produce the same issue.
> Example code - 
> {code:JavaScript|title=upload.js|borderStyle=solid}
> navigator.camera.getPicture(
> //success
> function(imageURI) {
> 	setTimeout(function() {
> 		alert('Picture taken');
> 		
> 		//Upload Options
> 		var options = new FileUploadOptions();
> 		//set defaults
> 		options.fileKey='primaryFile';
> 		options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
> 		options.mimeType='image/jpeg'; //or 'image/png'
> 		options.chunkedMode = false;
> 		
> 		//set default form params for service
> 		options.params = {
> 			dDocAuthor:		'me',
> 			dDocTitle:		'Mobile Upload Test', 
> 			dDocType:		'Document',
> 			dSecurityGroup:		'test',	
> 			dDocAccount:		'',		
> 			xComments: 		'Mobile Upload'
> 		};
> 		
> 		//Set Auth header
> 		var vAuthHeader = Crypto.util.bytesToBase64(Crypto.charenc.Binary.stringToBytes(FB.WebCenterSettings.userName
+ ':' + FB.WebCenterSettings.password));
> 		options.headers = {'Authorization': 'Basic ' + vAuthHeader};
> 		
> 		var fFileTransfer = new FileTransfer();
> 	
> 		fFileTransfer.upload(
> 			imageURI, 
> 			encodeURI(FB.WebCenterSettings[FB.WebCenterSettings.activeServer].ucmPath+'/idcplg?IdcService=CHECKIN_UNIVERSAL&IsJson=1'),
> 			//success
> 			function(r){
> 				alert('[Photo Sucessfully Uploaded]');
> 			}, 
> 			//fail
> 			function(error) {
> 				alert('[FAIL]');
> 			}, options, true);
> 	}, 0);
> 	
> 	
> //error
> }, function(message) {
> 	alert('[Fail]');
> //options
> },{ 
> 	quality: 		20,
> 	destinationType: 	Camera.DestinationType.NATIVE_URI,
> 	sourceType: 		Camera.PictureSourceType.CAMERA,
> 	encodingType: 		Camera.EncodingType.JPEG,
> 	targetWidth: 		650,
> 	targetHeight: 		650,
> 	saveToPhotoAlbum: 	false
> });
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message