How to use images from the device in Firefox OS

2019-09-10 13:39发布

问题:

In the application I'm building I want to show images from the device, but can't seem to figure out the proper way to do it. I'd like to let the user pick image, save the choice in localStorage and show it in img element.

I tried modifying Firefox OS Boilerplate App code for picking images, but it doesn't work because the blob changes everytime the app is opened. I have also read docs on Device Storage API but it doesn't mention referencing images in the app.

回答1:

It's hard to say any definitive answer based on the info you have provided - please share some code if you want us to be able to help you with your problem.

In the meantime, you might check out how I implemented this in my application - Check-in Fox, it should get you started. If you want to see the code in action, open the app and try opening any venue on the main screen (note: you will need to authenticate via Foursquare to be able to use this feature), then clicking on the Attach photo button.



标签: firefox-os