/*******
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/">
//html portion of viewing photo
<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>
imagePath变量成功打印=>“file:///store/home/user/camera/IMG-20120118-00001.jpg”。但照片没有显示出来。blackberry webworks:拍照后显示拍摄图像
我不明白我写的代码有什么问题。图像路径来了。
奇怪的是,当我将imagePath作为图像的src进行硬编码时,它可以显示图像。但是当我在successCB()中使用javascript设置它时,它不起作用。我在Firefox中测试了我的JavaScript代码的功能。它在基本的HTML中起作用。我使用黑莓9700与OS 6捆绑2921.我需要立即帮助。请我坚持这一整天
感谢core.B纠正我。我知道,但它并没有出现在我的脑海里。祝你今天愉快 – 2012-01-18 19:35:51