Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Save an image to the photo library (Android / iOS)?

Author
Message
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 23rd Jan 2013 23:51
We have a command to import an image directly from the default photo library of any device (GetCapturedImage). But, is it not possible to save images back to this photo library?

If not, this means we are stuck saving images to the sandboxed storage of the app on iOS/Android, thus preventing anyone from opening them in their default photo app or transferring them back to their PC via USB? Am I missing something obvious or is this the case? Is there any way to save an image in a manner that would allow the user to access them externally outside the app on a mobile device?

Both iOS and Android have very simple native commands to locate the photo library directory and save images to it. But again is this not possible in AppGameKit (if not, it seems the SaveImage command has lost a lot of potential)? I was working on porting a small image manipulation app and just realized this limitation.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Jan 2013 01:09
If you are working in Tier 2, in theory, you can use the commands you mention to get the location and then use the agk::GetWritePath() command to get where the sandbox file is, then you can use standard C commands to copy the image.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 24th Jan 2013 01:41
You can use PrintImage on iOS and Android to save to the device photos folder.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 24th Jan 2013 02:27 Edited at: 24th Jan 2013 02:28
Excellent, I overlooked that command! Thanks Paul

(AL thanks for that tip too--I'm trying to get by using Tier 1).
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 24th Jan 2013 03:17
After testing Paul's suggestion, I realize that PrintImage() is not useful for saving to the library in its current state. There is no way to customize the filename or path, so it just saves an image named "PrintedImage.png" to the absolute root of the memory stick on Android.

If two more parameters could be added to specify a filename and subdirectory (or inherit from SetFolder) that'd be much appreciated. Right now its only good for saving a single image and is still not very accessible to the end user.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Jan 2013 16:37
SetFolder will not allow you to select a folder outside of the sandbox area.

As far as I know, there are no AppGameKit commands that let you set a folder or affect a file/folder outside of the sandbox area.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 24th Jan 2013 16:48 Edited at: 24th Jan 2013 16:49
Quote: "Paul wrote : You can use PrintImage on iOS and Android to save to the device photos folder."


How exactly ?
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 25th Jan 2013 18:59 Edited at: 25th Jan 2013 19:01
Anyone know how this could be achieved in Tier 2 using C++ (e.g., for an Android port)? Android has a simple method for retrieving any of the public external directories (e.g., Music, Photos) but I have no idea how this could be worked into the C++ needed by AppGameKit if going this route. Again I hate to think about converting thousands of lines of AppGameKit BASIC to Tier 2 just to support saving images to the photo library, but that's the only option at this point.

Here's the Java method:



I'd love to see a C++ snippet that works with AppGameKit to copy a file from the local (e.g., media) directory to the public photo library.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Jan 2013 20:08
After a bit of surfing (looking for the simplest method) this page gives a few options (all can be turned into a function that is reusable).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-05-06 15:31:21
Your offset time is: 2024-05-06 15:31:21