Is it possible to load a user specified image into my corona app?
Do we have access to anything outside of the files that came with our downloaded app? [import]uid: 106158 topic_id: 26998 reply_id: 326998[/import]
Is it possible to load a user specified image into my corona app?
Do we have access to anything outside of the files that came with our downloaded app? [import]uid: 106158 topic_id: 26998 reply_id: 326998[/import]
Can you elaborate a little further?
If you mean say showing a textfield for a user to input a image url and download it into your app then yes of course [import]uid: 84637 topic_id: 26998 reply_id: 109524[/import]
Why yes you do…
you can access files directly in:
system.DocumentsDirectory
system.CachesDirectory
and
system.TemporaryDirectory
(and of course in your app bundle at: system.ResourceDirectory)
And there is read only access to the camera roll.
So how do files get into those 3 directories?
You can download them from the Internet.
You can have your app create them there.
Starting with a daily build a couple of weeks ago, we now have access to the Lua file system via LFS. See the blog for several posts about LFS being added.
With LFS you can scan a directory (and even make and use sub-directories) for a list of files, then present that list to the user of your app, let them select a file and then you use that file the way you would any file via Corona.
[import]uid: 19626 topic_id: 26998 reply_id: 109526[/import]
Danny,
To clarify:
I am wondering if I can have either select some location like an images directory on the tablet, outside of my app’s folders, and load images from that location or give the user access to one of my app’s folders where they can copy in an image?
The url solution might work for what i have in mind.
Robmiracle,
Thanks for the explanation.
[import]uid: 106158 topic_id: 26998 reply_id: 109544[/import]
Apps as a rule cannot access things outside their sandbox, so sharing files between apps is not trivial. The Camera Roll is a notable exception since it would be kinda useless for any photography apps to work without access. Likewise, Apple makes accessing contacts and such available through their APIs.
But for two non-Apple apps to try and share data files is frankly unsafe and Apple has in the sake of security made it so one app can’t write to another nor read from another.
Now that doen’t mean you can’t have two apps that one acts like an FTP server and the other a client and they open network sockets between each other and transfer files that way. There is nothing preventing you from implementing a Box.net or Dropbox api to share files that way either.
But the short answer is two apps can’t read/write each other’s files. [import]uid: 19626 topic_id: 26998 reply_id: 109557[/import]
Makes sense, I suspected this was the case. I guess I will be looking at transferring files over the network then.
Thank you, for your additional explanation!
[import]uid: 106158 topic_id: 26998 reply_id: 109578[/import]