/*******
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