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

Web and WebWorks Development

Reply
New Developer
Posts: 65
Registered: ‎08-07-2013
My Device: Blackberry Torch 9800
My Carrier: Mobile App Development

How to get the selected image path using javascript?

Hi All,

 

I have developed web application using Ripple Emulator and Blackberry webworks SDK 2.3.1.5 for Blackberry 6 and earlier. In that i have to get the selected image path for convert base64 string using canvas. Because after get the image path, i will send that path to base64 conversion method. If anybody know Please me to achieve this task. Thanks a lot in Advance..

 

With Regards,

Marimuthu_P

 

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: How to get the selected image path using javascript?

can you confirm you are trying to use a Cavas to save an image in Base64 format?

 

If so, you will be looking for something like this:

 

var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');

// save canvas image as data url (png format by default)
var dataURL = canvas.toDataURL();

 

Source:

http://www.html5canvastutorials.com/advanced/html5-canvas-get-image-data-url/

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Highlighted
New Developer
Posts: 65
Registered: ‎08-07-2013
My Device: Blackberry Torch 9800
My Carrier: Mobile App Development

Re: How to get the selected image path using javascript?

Hi Astanley,

 

Thanks for your reply, Now i've converted base64 format. But i have to get selected image path only. Because i'm using below code to get image path.

function AddEventChoosePicture() {
	webworks.ui.filePicker.open(doCallback);
}	
function doCallback(file) {
        alert('You selected file: ' + file);
	baseconversion(file);
}

 I got the selected image path using this code in BB 9330. But this code not work in BB 9800 even i can't browse the image. Please help me ASAP.. Thanks a lot.. Waiting for your reply..

 

With Regards,

Marimuthu_P