You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/08/14 10:56:33 UTC
[GitHub] MichaelSamteladze opened a new issue #327: Image as base64 to style
background-image:url() issue
MichaelSamteladze opened a new issue #327: Image as base64 to style background-image:url() issue
URL: https://github.com/apache/cordova-plugin-camera/issues/327
If you have following setup:
`navigator.camera.getPicture(
SuccessCallback,
.ErrorCallback,
{
quality: 40,
destinationType: Camera.DestinationType.DATA_URL,
encodingType: Camera.EncodingType.JPEG,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
correctOrientation: true,
cameraDirection: Camera.Direction.FRONT
}
);`
and
`OnTakePictureSuccess: function (ImageBase64) {
ImageBase64 = 'data:image/jpeg;base64,' + ImageBase64
$(Selector).attr('style', "background-image:url('" + ImageBase64 + "')");'');
}`
Displays empty image, but if you replace some whitespaces and newlines in Base64 then it works
`ImageBase64 = 'data:image/jpeg;base64,' + ImageBase64.replace(/\r?\n|\s{1,}/g, '');`
Problem found on iOS 9 and Android 6.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org