Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Well, you could try changing 'documents' to 'Documents' in the path, although the dictionary doesn't list it that way. Beyond that, I just don't know enough about the environment your developing for. Hopefully someone that does can chip in.
from the dictionary about "mobilepickphoto": ...
If the user cancels the pick, the command returns with result cancel.
Otherwise a new image object is created on the current card of the
default stack containing the chosen image.
...
Means your script does not work, do something like this:
on mouseUp
mobilePickPhoto "camera"
## User clicked CANCEL:
if the result = "cancel" then
exit mouseup
end if
put last img into URL("binfile:"& specialFolderPath("documents") & "/pic.jpg")
## Optional:
delete last img
end mouseUp
spcecialfolderpath("documents") (yes, a small d is correct, since iOS and Android are case-sensitive OPs!) is the folder on mobile where we definitively have write permission, so everything we/the user will save to disk goes here!
on mouseUp
mobilePickPhoto "camera"
## User clicked CANCEL:
if the result = "cancel" then
exit mouseup
end if
put last img into URL("binfile:"& specialFolderPath("documents") & "/pic.jpg")
## Optional:
--delete last img
end mouseUp
on mouseUp
mobilePickPhoto "camera"
## User clicked CANCEL:
if the result = "cancel" then
exit mouseup
end if
## We try to export the image to a JPG file:
export last img to file (specialFolderPath("documents") & "/pic.jpg") as JPEG
## If the export fails for some reason, maybe we get some hint from THE RESULT
if the result <> EMPTY then
answer "Error while exporting image:" && the result
end if
## Optional:
--delete last img
end mouseUp
on mouseUp
mobilePickPhoto "camera"
## User clicked CANCEL:
if the result = "cancel" then
exit mouseup
end if
## We try to export the image to a JPG file:
export last img to URL ("binfile:" & specialFolderPath("documents") & "/pic.jpg") as JPEG
## If the export fails for some reason, maybe we get some hint from THE RESULT
if the result <> EMPTY then
answer "Error while exporting image:" && the result
end if
## Optional:
--delete last img
end mouseUp
on mouseUp
mobilePickPhoto "camera"
## User clicked CANCEL:
if the result = "cancel" then
exit mouseup
end if
## We try to export the image to a JPG file:
export last img to file (specialFolderPath("documents") & "/pic.jpg") as JPEG
## If the export fails for some reason, maybe we get some hint from THE RESULT
if the result <> EMPTY then
answer "Error while exporting image:" && the result
end if
## Optional:
--delete last img
end mouseUp
Where are you looking for the picture? The documents folder is local to the app, it is not public or visible in an Android file manager. If you get files(specialFolderPath("documents")) you should see it in the list. But if you look in the photo gallery it won't be there.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
You can save the image to the public documents folder using specialFolderPath ("external documents") in the file path. Be sure you have selected the 'Write External Storage' permission in the Android standalone settings. Images stored there will be available to other apps.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
mobilePickPhoto "camera"
set the defaultFolder to "/mnt/sdcard/DCIM/"
put last image into url("binfile:" & milliseconds() & ".jpg")
But also the function "mobileExportImageToAlbum" has make a picture in the android directory. But I din't found the picture at these time, because my gallary application should only show picture from the adjusted / used library of the abdroid camera application. But nowadays I'm lucky with the code above.