06-25-2013 06:32 PM
My requirement is to be able to download new images for a phonegap webworks application.
I am currently setting sandbox to false
I am requesting the filesystem and downloading a test jpg to blackberry.io.sharedFolder + /misc
I am seeing the file in my shared folder
Is it possible to use this in html or coverflow in the img src?
I have tried taking the fullPath return value from blackberry.io.sharedFolder +"/misc/test.jpg" and hardcoding it into src but no image appears. How would you access this?
Here is the entry.fullPath
If it is possible to do what needs to go into img src?
Thanks, I appreciate any help I can get.
Solved! Go to Solution.
06-25-2013 06:56 PM
I found this out on another thread. It works with:
I did hear somewhere that accounts/1000 could change though. If there is a better way let me know.
06-26-2013 06:28 PM
I'm accepting your own response as the solution but just wanted to add two more things:
1) In your config.xml, you will need to whitelist the file:///accounts/ uri via the <access> element.
2) You can use the IO APIs to use the variable representing the shared folder instead of hardcoding a path:
If the path were to ever change, that variable should be updated to reflect that.
07-01-2013 03:56 PM
I have this working for shared folders but my requirement is that the user can't delete any of the files without deleting the application. Is there a way to use persistent storage instead of shared folders to store the image and use it in html?
I am able to download to the persistent storage but I am unable to access it from src=.
For example, I downloaded a file to persistent/Concept folder
I then have tried many ways to access it. One way was the following:
The file seemed to have downloaded but I am unable to view it.
07-03-2013 12:27 PM
Since you're downloading these images and saving them, you have access to the file blob (you need a Blob/ArrayBuffer object to pass into the fileWriter in order to save something). You can obtain a useable URL to pass to any src attribute from this blob like so:
And voila! It works This gets you away from using the messy '/account/whatever' nonsense as you won't always have permission to access directories. ALSO, it abstracts the URL to point to data and not a file, so it doesn't matter where you've saved it (being shared folder, app sandbox, or html5 filesystem sandbox).
Hope that helps!