[ 
https://issues.apache.org/jira/browse/CB-12512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15886592#comment-15886592
 ] 

Kerri Shotts commented on CB-12512:
-----------------------------------

1. Why are you using PNGs? These are horrible for photographs -- they take up a 
large amount of memory and do not compress well.

2. Make sure you use the correct preamble for the image type; 
data:image/png;base64 is not appropriate for JPEGs (and vice versa).

3. Do you need the full-resolution image taken? If not, set the {{targetWidth}} 
and {{targetHeight}} options to a reasonable value. The smaller the image you 
request, the smaller the resulting DATA_URL will be (and thus, the faster the 
image can be rendered). You do not need to worry about aspect ratio; the 
returned image will fit within the width & height specified.

> No way to get from a FILE_URL to a DATA_URL onsuccess
> -----------------------------------------------------
>
>                 Key: CB-12512
>                 URL: https://issues.apache.org/jira/browse/CB-12512
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, iOS
>         Environment: Android 4.0+ / iOS 9.0+
>            Reporter: Kyle Slack
>
> The onsuccess function of the getPicture method uses the FILE_URI to set an 
> <img> source perfectly fine, however, the conversion of this FILE_URI to get 
> the image data or DATA_URL is never successful no matter the means attempted. 
> Even utilizing your posted methods to get the actual file have failed:
> window.resolveLocalFileSystemURL(imgUri, function success(fileEntry) - is not 
> getting to the image, always results in null DATA_URL in the end.
> Our method using FILE_URI:
> {code}
> navigator.camera.getPicture(function (data) {
>             setTimeout(function () {
>                 StatusBar.overlaysWebView(true);
>                 setTimeout(function () {
>                     StatusBar.overlaysWebView(false);
>                 }, 250);
>             }, 250);
>             viewModel.txtImageStatus("Loading...");
>             document.getElementById("image").src = data; 
>             viewModel.showNoImage(false);
>             document.getElementById("image").style.display = "block";
>             SavetoShipment(data);
>         }, function (msg) {
>             if (!msg == "Camera cancelled.") {
>                 viewModel.popVisible(true);
>                 viewModel.popMessage("Failed: " + msg);
>             };
>             setTimeout(function () {
>                 StatusBar.overlaysWebView(true);
>                 setTimeout(function () {
>                     StatusBar.overlaysWebView(false);
>                 }, 250);
>             }, 250);
>         }, {
>             quality: DevExpress.devices.real().platform == "ios" ? 50 : 100,
>             destinationType: Camera.DestinationType.FILE_URI,
>             saveToPhotoAlbum: false,
>             correctOrientation: true,
>             encodingType: DevExpress.devices.real().platform == "ios" ? 
> Camera.EncodingType.PNG : Camera.EncodingType.JPEG
>         });
> function SavetoShipment(fileURI) {
>         var fileReader = new FileReader();
>         fileReader.onload = function (fileLoad) {
>             viewModel.shipment.CustomerPhotoInfo = fileLoad.target.result;
>         };
>         fileReader.readAsDataURL(fileURI);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to