/*******
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”。但照片没有出现。
我不明白我写的代码有什么问题。图片路径没问题。
奇怪的是,当我将 imagePath 硬编码为图像的 src 时,它可以显示图像。但是当我在successCB()中使用javascript设置它时,它不起作用。我在 Firefox 中测试了我的 javascript 代码的功能。它适用于基本的html。我正在使用带有 os 6 bundle 2921 的 Blackberry 9700。我需要立即帮助。请我坚持一整天