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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 20
Registered: ‎11-22-2011
My Device: blackberry bold- 9700
My Carrier: none
Accepted Solution

showing captured image after taking photo

[ Edited ]
/*******
works when "Take Photo" button clicked
********/
function takePicture() {
    var result = blackberry.media.camera.takePicture(successCB);
}


/*******
post processing of photo click event
********/
function successCB(filePath) {
    try{
        blackberry.media.camera.close();
        var imagePath = "file://" + filePath;
        document.getElementById('images').setAttribute('src', imagePath.toString());
        document.getElementById("photoDetails").innerHTML = imagePath;
    }
    catch(e) {
        document.getElementById("photoDetails").innerHTML = e.ToString();
    }
}


//ConfigFile includes the following,  <access subdomains="false" uri="file:///store/home/user/camera/">
<ul>
                <li id="Li1">
                    <img id="Img1" alt="image" src="file:///store/home/user/camera/IMG-20120118-00001.jpg" /></li>
                <li id="photoDetails">
                    <img id="images" alt="image" src="kkkoj" /></li>
            </ul>

 

 

the imagePath variable successfully prints => "file:///store/home/user/camera/IMG-20120118-00001.jpg". but the photo is not showing up. 

 

i don't understand whats the problem with the code i have written. image path came alright.

 

Strangely when i hardcode the imagePath as a src of image it can show the image. but when i set it using javascript in successCB(), it doesn't work. i tested the functionality of my javascript code in firefox. it works in basic html. i am using Blackberry 9700 with os 6 bundle 2921. i need immediate help. please i am stuck with this for a whole day

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: showing captured image after taking photo

Try:

 

document.getElementById('images').src=imagePath;

 

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Contributor
Posts: 20
Registered: ‎11-22-2011
My Device: blackberry bold- 9700
My Carrier: none

Re: showing captured image after taking photo

i got another answer by Core.B which solved my problem. thank you jcarty for being responsive with me. happy coding everybody.

 

"You're use of document.getElementById("photoDetails").innerHTML is the problem. .innerHTML replaces everything in between the opening and closing tags of <li id="photoDetails">. Since images is in photoDetails, it is getting erased with just the imagePath.

If you want to display the imagePath, try adding a <div> or <span> and updating them with the path.

Also, I don't think you need the <access> element in your configuration file, since that is only used for accessing external servers."

 


Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: showing captured image after taking photo

Great! Glad you figured it out.
Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Contributor
Posts: 10
Registered: ‎02-24-2011
My Device: Bold 9700
My Carrier: AT&T

Re: showing captured image after taking photo

Oooh. I'm getting mentions here too Smiley Happy

 

Maybe I should hang out here more often than on Stack Overflow.

Highlighted
Contributor
Posts: 20
Registered: ‎11-22-2011
My Device: blackberry bold- 9700
My Carrier: none

Re: showing captured image after taking photo

welcome to blackberry community coreb. Smiley Happy your help was in right time.