Hi I'm using the phonegap Camera API on iOS. I'd like to take picutres in a square 640x640 format. This works fine when I use the sourceType of the camera. But if I use this targetWidth and targetHeight in the sourceType for the phones image library, it will only work if the image fits fully into the defined square. If the image from the library is taken in landscape and the height is smaler than the defined targetHeigt (640), the image won't be square and it will keep its orignal height. I was expecting a black boxing which fills up the empty space so it will be 640. This only hapens when I use the camera and taking a landscape picture and setting correctOrientation:1.
Here my code for camera and photolibrary
Camera:
var options = {
quality: 49,
allowEdit : true,
targetWidth: 640,
targetHeight: 640,
correctOrientation: 1,
saveToPhotoAlbum: 1,
//destinationType: Camera.DestinationType.FILE_URI,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: 1, // 0:Photo Library, 1=Camera, 2=Saved Photo Album
encodingType: 0 // 0=JPG 1=PNG
}
navigator.camera.getPicture(onSuccess,onFail,options, {limit:2});
Library:
var options = {
quality: 49,
allowEdit : true,
targetWidth: 640,
targetHeight: 640,
correctOrientation: 1,
//destinationType: Camera.DestinationType.FILE_URI,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: 0, // 0:Photo Library, 1=Camera, 2=Saved Photo Album
encodingType: 0 // 0=JPG 1=PNG
}
navigator.camera.getPicture(onSuccess,onFail,options);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With