Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Kiran_Snist
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified
Accepted Solution

converting image file to base64encoding string

I tried conveting image to base64 encoding stirng to be sent to the server.. I am able to retrieve the file path succesfully using file picker, but converting image to string is raising concerns. I used base64outputstream n all sort of stuff.. But Sometimes they work, some times they wont... I want to have a code snippet which accomplishes my task... Can some1 help me???

Please use plain text.
Developer
kanaksony
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: converting image file to base64encoding string

try{
	if(capturedImageBytes!=null)
		inputRaw = net.rim.device.api.io.Base64OutputStream.encodeAsString
(capturedImageBytes, 0, capturedImageBytes.length, false, false);
}catch(Throwable th){
	System.out.println("th.getMessage() ########## image ### inputRaw -------------- " +th.getMessage());
}

   I guess, It sometimes fail due to image size too big..

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Please use plain text.
Developer
Kiran_Snist
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified

Re: converting image file to base64encoding string

So, Is there a certain size limit for outputstream ?

Please use plain text.
Developer
Kiran_Snist
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified

Re: converting image file to base64encoding string

I suggest developers who are encoding the image to resize the image programitically before encoding.. this will accomplish the Encoding task 99 out of 100 times :smileytongue: ...  

Please use plain text.