[jira] [Commented] (CB-11692) Unable to load .png image from gallery

2016-08-19 Thread Mohammed Sadiq M C (JIRA)

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

Mohammed Sadiq M C commented on CB-11692:
-

[~vladimir.kotikov] Please find below code snippet used in my application. As I 
mentioned earlier, JPG images are getting attached but not PNG. Also I tried 
there is no reason for error received in _image.onerror_. 
{code}

$('#btnGallery').click(function () {
getPhoto(navigator.camera.PictureSourceType.SAVEDPHOTOALBUM);
});

function getPhoto(source) {
navigator.camera.getPicture(function (imageURI) { 
addLoader();
onPhotoURISuccess(imageURI);
}, CameraFail, {
quality: 35,
destinationType: navigator.camera.DestinationType.FILE_URI,
saveToPhotoAlbum: false,
sourceType: source,
allowEdit: false,
targetWidth: 600,
targetHeight: 800
});
}

function onPhotoURISuccess(imageURI) {
  // converts the image to a 2d canvas
  canvasimage(imageURI);
}

function canvasimage(src) {
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
var imgdata = new Image;

imgdata.onload = function () {
canvas.width = this.width;
canvas.height = this.height;
ctx.drawImage(this, 0, 0);
dataURL = canvas.toDataURL('image/jpeg');

var blob = dataURItoBlob(dataURL);
gotfilesystem(blob);
}

 imgdata.onerror = function () {
 alert('error');
 }

imgdata.src = src;
}

function dataURItoBlob(dataURI) {
// convert base64/URLEncoded data component to raw binary data held in a 
string
var byteString;
if (dataURI.split(',')[0].indexOf('base64') >= 0)
byteString = atob(dataURI.split(',')[1]);
else
byteString = unescape(dataURI.split(',')[1]);

// separate out the mime component
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];

// write the bytes of the string to a typed array
var ia = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}

return new Blob([ia], { type: mimeString });
}
.
{code}

> Unable to load .png image from gallery
> --
>
> Key: CB-11692
> URL: https://issues.apache.org/jira/browse/CB-11692
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin Camera
>Affects Versions: 1.2.0
> Environment: Cordova Version: 5.0.0
> Installed Platform: wp8
> Plugins:
> cordova-plugin-camera 1.2.0 "Camera"
> cordova-plugin-file 3.0.0 "File"
> cordova-plugin-file-transfer 1.4.0 "File Transfer"
> cordova-plugin-whitelist 1.2.0 "Whitelist"
> cordova.plugins.diagnostic 1.1.0 "Diagnostic"
>Reporter: Mohammed Sadiq M C
>  Labels: wfc, wp8
>
> I am blocked with image selection from gallery. I cant able to load the .png 
> image selected from gallery to the UI. Appreciating for the fix .



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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



[jira] [Commented] (CB-11692) Unable to load .png image from gallery

2016-08-18 Thread Vladimir Kotikov (JIRA)

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

Vladimir Kotikov commented on CB-11692:
---

Thanks for the clarification. Please also post repro code, so we can verify the 
problem.

> Unable to load .png image from gallery
> --
>
> Key: CB-11692
> URL: https://issues.apache.org/jira/browse/CB-11692
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin Camera
>Affects Versions: 1.2.0
> Environment: Cordova Version: 5.0.0
> Installed Platform: wp8
> Plugins:
> cordova-plugin-camera 1.2.0 "Camera"
> cordova-plugin-file 3.0.0 "File"
> cordova-plugin-file-transfer 1.4.0 "File Transfer"
> cordova-plugin-whitelist 1.2.0 "Whitelist"
> cordova.plugins.diagnostic 1.1.0 "Diagnostic"
>Reporter: Mohammed Sadiq M C
>  Labels: wfc, wp8
>
> I am blocked with image selection from gallery. I cant able to load the .png 
> image selected from gallery to the UI. Appreciating for the fix .



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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



[jira] [Commented] (CB-11692) Unable to load .png image from gallery

2016-08-17 Thread Mohammed Sadiq M C (JIRA)

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

Mohammed Sadiq M C commented on CB-11692:
-

[~vladimir.kotikov] Below mentioned are the cordova version, installed platform 
and few plugins installed.

*Cordova Version*: 5.0.0

*Installed Platform*: wp8

*Plugins*: 
* cordova-plugin-camera 1.2.0 "Camera"
* cordova-plugin-file 3.0.0 "File"
* cordova-plugin-file-transfer 1.4.0 "File Transfer"
* cordova-plugin-whitelist 1.2.0 "Whitelist"
* cordova.plugins.diagnostic 1.1.0 "Diagnostic"

> Unable to load .png image from gallery
> --
>
> Key: CB-11692
> URL: https://issues.apache.org/jira/browse/CB-11692
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin Camera
> Environment: Windows Phone 8
>Reporter: Mohammed Sadiq M C
>  Labels: wfc, windows
>
> I am blocked with image selection from gallery. I cant able to load the .png 
> image selected from gallery to the UI. Appreciating for the fix .



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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



[jira] [Commented] (CB-11692) Unable to load .png image from gallery

2016-08-15 Thread Vladimir Kotikov (JIRA)

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

Vladimir Kotikov commented on CB-11692:
---

[~sadiqmc] Which cordova platform are you using? Is that WP8 or Windows 
platform? Also please elaborate what does mean "I cant able to load the .png 
image selected from gallery"? Are you getting any errors or your code isn't 
working as expected?

Please also specify your cordova, platforms and plugins versions - you can get 
them via {{cordova --version && cordova platform ls && cordova plugin ls}}


> Unable to load .png image from gallery
> --
>
> Key: CB-11692
> URL: https://issues.apache.org/jira/browse/CB-11692
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin Camera
> Environment: Windows Phone 8
>Reporter: Mohammed Sadiq M C
>  Labels: wfc, windows
>
> I am blocked with image selection from gallery. I cant able to load the .png 
> image selected from gallery to the UI. Appreciating for the fix .



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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