[jira] [Commented] (CB-11199) Plugin File: FileReader readAsDataURL does not work with JPG on Android 4.4.2

2016-08-16 Thread Vladimir Kotikov (JIRA)

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

Vladimir Kotikov commented on CB-11199:
---

This should be fixed in 
[#191|https://github.com/apache/cordova-plugin-file/pull/191]

> Plugin File: FileReader readAsDataURL does not work with JPG on Android 4.4.2
> -
>
> Key: CB-11199
> URL: https://issues.apache.org/jira/browse/CB-11199
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin File
>Affects Versions: 4.2.0
> Environment: Android 4.4.2
>Reporter: Caner Patır
>  Labels: Android, triaged, wfc
>
> FileReader readAsDataURL method encodes invalid base64 data for a jpeg image. 
> I could not decode the generate base64 data. But iI tried the same situation 
> on version 4.1.1 it works successfully. 



--
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-11199) Plugin File: FileReader readAsDataURL does not work with JPG on Android 4.4.2

2016-07-19 Thread Dylan van der Merwe (JIRA)

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

Dylan van der Merwe commented on CB-11199:
--

This is a pretty serious issue. For any file larger than 256k the readAsDataURL 
method will not work!

Has anyone been assigned to this?

Has also been discussed here:
http://stackoverflow.com/questions/38405259/how-to-read-valid-base64-file-in-android-cordova/38458398#38458398

> Plugin File: FileReader readAsDataURL does not work with JPG on Android 4.4.2
> -
>
> Key: CB-11199
> URL: https://issues.apache.org/jira/browse/CB-11199
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin File
>Affects Versions: 4.2.0
> Environment: Android 4.4.2
>Reporter: Caner Patır
>  Labels: Android, triaged, wfc
>
> FileReader readAsDataURL method encodes invalid base64 data for a jpeg image. 
> I could not decode the generate base64 data. But iI tried the same situation 
> on version 4.1.1 it works successfully. 



--
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-11199) Plugin File: FileReader readAsDataURL does not work with JPG on Android 4.4.2

2016-06-10 Thread D H (JIRA)

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

D H commented on CB-11199:
--

I also discovered the encoding each chunk behavior.  As James mentioned, I 
tested upping the READ_CHUNK_SIZE, but I still experienced issues when it came 
to reading PDF files.  I was able to work around it by breaking out each 256K 
chunk from the resulting data, decoding it, and then re-encoding the whole 
string.

For reference, I was testing on an Android 6.0.0 device.

> Plugin File: FileReader readAsDataURL does not work with JPG on Android 4.4.2
> -
>
> Key: CB-11199
> URL: https://issues.apache.org/jira/browse/CB-11199
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin File
>Affects Versions: 4.2.0
> Environment: Android 4.4.2
>Reporter: Caner Patır
>  Labels: Android, triaged, wfc
>
> FileReader readAsDataURL method encodes invalid base64 data for a jpeg image. 
> I could not decode the generate base64 data. But iI tried the same situation 
> on version 4.1.1 it works successfully. 



--
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-11199) Plugin File: FileReader readAsDataURL does not work with JPG on Android 4.4.2

2016-06-10 Thread James Williams (JIRA)

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

James Williams commented on CB-11199:
-

Upgraded from Android 3.7.1 to 5.1.1 and encountered this issue with FileReader 
readAsDataURL.  

FileReader readAsDataURL is broken when it comes to base 64 encoding of large 
files.  It is base64 encoding each 256K chunk and appending them together 
before returning them in FileReader.js.  That results in a base64 string that 
will not decode.

Our workaround was to override FileReader.READ_CHUNK_SIZE in the "deviceready" 
event and set it to a value > 256K. 

Example:

 FileReader.READ_CHUNK_SIZE = 104857600;

I hope this helps you.









> Plugin File: FileReader readAsDataURL does not work with JPG on Android 4.4.2
> -
>
> Key: CB-11199
> URL: https://issues.apache.org/jira/browse/CB-11199
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin File
>Affects Versions: 4.2.0
> Environment: Android 4.4.2
>Reporter: Caner Patır
>  Labels: Android, triaged, wfc
>
> FileReader readAsDataURL method encodes invalid base64 data for a jpeg image. 
> I could not decode the generate base64 data. But iI tried the same situation 
> on version 4.1.1 it works successfully. 



--
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-11199) Plugin File: FileReader readAsDataURL does not work with JPG on Android 4.4.2

2016-05-05 Thread JIRA

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

Caner Patır commented on CB-11199:
--


Encode :

function (path, file) {
  var q = $q.defer();

  if ((/^\//.test(file))) {
  q.reject('file-name cannot start with \/');
  }

  try {
  $window.resolveLocalFileSystemURL(path, function 
(fileSystem) {
  fileSystem.getFile(file, { create: false }, function 
(fileEntry) {
  fileEntry.file(function (fileData) {
  var reader = new FileReader();
  reader.onloadend = function (evt) {
  if (evt.target.result !== undefined || 
evt.target.result !== null) {
  q.resolve(evt.target.result);
  } else if (evt.target.error !== undefined 
|| evt.target.error !== null) {
  q.reject(evt.target.error);
  } else {
  q.reject({ code: null, message: 
'READER_ONLOADEND_ERR' });
  }
  };
  reader.readAsDataURL(fileData);
  });
  }, function (error) {
  error.message = $cordovaFileError[error.code];
  q.reject(error);
  });
  }, function (err) {
  err.message = $cordovaFileError[err.code];
  q.reject(err);
  });
  } catch (e) {
  e.message = $cordovaFileError[e.code];
  q.reject(e);
  }

  return q.promise;
  },


Decode with c#:

   string base64 = ;
var bytes = Convert.FromBase64String(base64);




> Plugin File: FileReader readAsDataURL does not work with JPG on Android 4.4.2
> -
>
> Key: CB-11199
> URL: https://issues.apache.org/jira/browse/CB-11199
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: Plugin File
>Affects Versions: 4.2.0
> Environment: Android 4.4.2
>Reporter: Caner Patır
>  Labels: Android, triaged, wfc
>
> FileReader readAsDataURL method encodes invalid base64 data for a jpeg image. 
> I could not decode the generate base64 data. But iI tried the same situation 
> on version 4.1.1 it works successfully. 



--
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