By the way, when I run my codes, I see "security warning" three times.
I don't want to see them. Can I disable the security warning?
By the way, when I run my codes, I see "security warning" three times.
I don't want to see them. Can I disable the security warning?
Well there are couple of options, both of which are not perfect:
Root problems lies in platformservices.js in line 3842:
Workarounds:Code:var d=new Date(Date.parse(item.FileDate)); //fails to parse localized timestamp if(d>__sp_camera_start_date){ }
1)
Implement your own parseFunction, that is able to parse item.FileDate, that is in Chinese to JavaScript Date object.
var d=new Date(myOwnParseFunction(item.FileDate));
For starters you could print out item.FileDate to see the format and then make a script to parse it.
2)
Get rid of the date comparison altogether and just use the first image that is returned. In this case user may be confused, if she/he didn't take the image, but just closed the app.
This one is easier to implement, but can cause bad UX. One option would be to use media management api to retrieve list before calling take picture, and then compare the list to one retrieved after resuming to widget. However this would in practice mean writing your own camera functionality.
Br,
Ilkka
THANX !!!!!
-------------------------------------
Last problem: I use the following line to display a photo
document.getElementById("photo").src = photo_array[photo_array.length - 1].uri;
but the photo can't be displayed until I manually refresh the webpage.
How to automatically refresh the photo?
The last problem is most likely due to fact, that pictures taken with the camera are huge. Changing the camera resolution to smallest one should help with this problem.
Better option is to use Platform services 2.0 media management API to get thumbnail of the image.
Br,Code:// global service object var thumbso; // ErrorCallback function function errorCB(err) { alert("ErrorCode: " + err.code + " ErrorMessage: " + err.message); } // callback function function showThumb(uri){ document.getElementById("photo").src = uri; } function getThumb(image_uri){ try { thumbso = nokia.device.load("media"); alert(image_uri); image_uri = image_uri.substring(8, image_uri.length); //strip file:/// image_uri = "file://"+image_uri; var thumb={ uri: image_uri, size:{ width: 200, height: 150 } } var transactionId = thumbso.getThumbnail(showThumb, thumb, errorCB); } catch(e) { alert(e); } }
Ilkka
Hi,
One more update.
I wrote a wiki article about taking the image and retrieving a thumbnail.
http://www.developer.nokia.com/Commu...2.0_Camera_API
In process of writing the example app, I ran into a problem in acquiring the latest image. I always got the second last image. I traced this back into native camera app launching logic and managed to fix it by tweaking platformservices.js. You might want to check those changes, from the example app, attached in the wiki article.
Br,
Ilkka