I stripped down my app to just the pictures page and for some reason mobilepickphoto "camera" isn't working on my test Android on my test app. However it is mimicking the problem - because instead of going to the camera, it grabs an image off the stack and uses it - and then, per my code, deletes it. (You can see it delete various images in the header).
The primary code is in button "take_picture".
The only difference between this and my real stack is that the real stack goes through the camera, and when you click discard, then takes and image off the stack and deletes it. I could get rid of the delete it code, but then when someone goes to another feature (uploading an existing image or taking a new picture), this image sometimes interferes with the process - so I thought the best thing was to delete it when it was done being saved.
Everything on my real app works fine - except when you discard a picture and don't take a new one....then it becomes a mess. I tried having it detect whether the image was empty or blank, but it didn't work.
So for my problem, either, mobilepickphoto "camera" needs to detect that there is no picture, or a workaround is that if it can't find the substitute image that it deleted, it can create a new one (by copying an image off the resources file).
If that is the workaround, I can figure out how to rename an existing image, but haven't figured out how to copy and existing backup image into a new image (since renaming a backup would only work one time.) Probably simple, but now I'm distracted trying to figure out why mobilepickphoto "camera" doesn't work on my example...
---------
Livecode can be great...and it can drive me nuts. I tried uploading my app - but apparently I don't have those privileges. So, here's the workaround:
First, I have posted the livecode app (stripped down for the picture card only) at
http://www.toolsforbusiness.info/disast ... e.livecode
Here is the code for the button "take_picture"
Code: Select all
on mouseUp
put mobileControlGet(mytwentyFirstInputField,text) into tname
if tname is "blank" or tname is "" or tname is " " then
answer "Please select a name before taking a picture."
else
put the width of this stack into tStackWidth
put the height of this stack into tStackHeight
-- ## Use 2% of the width or height for spacing
put (tStackWidth * 0.02) into tHorizontalSpace
put (tStackHeight * 0.02) into tVerticalSpace
if the environment = "mobile" then
//sets loc/size of image on stack
set the lockloc of the templateimage to true
set the width of the templateimage to tstackwidth*.40
set the height of the templateimage to tstackwidth*.50
set the left of the templateimage to the left of field "picture_field" + thorizontalspace*2
set the top of the templateimage to tstackwidth*.40
##put field "tid" of card "docs" into tid
put 19 into tid
put tid & "_" & tname & ".png" into usethisname
// select image from phone camera
mobilepickphoto "camera"
// names image "libimage"
set the name of last image to "libImage"
-- if the platform is "android" then
-- answer "switching angle"
-- set the angle of image "libImage" to -90
-- answer "done"
-- end if
set the top of image "libImage" to the bottom of field "label_save"
set the left of image "libimage" to the left of button "cancel_existing"
answer "Please wait for the picture to be saved."
//uploads to ftp
put "ftp://myftploginstuff/disaster/docs/" & usethisname into sendthis
replace SPACE with "%20" in sendthis
put image libImage into URL(sendthis)
answer "Your picture was saved."
answer "We are now saving it to the remote database. Click OK and wait for the Finished notice."
put "http://mywebaddresswithextensions/add_resource_remote.cfm?id=" & tid & "&document_address=" & usethisname & "&docname=" & tname & "" into turl
replace SPACE with "%20" in tURL
put url (turl) into theData
set the vis of button "take_picture" to false
set the vis of button "cancel_existing" to false
set the vis of button "new_picture" to true
set the vis of button "existing_image" to true
set the vis of image "libImage" to false
set the vis of field "label_save" to false
if the environment is "mobile" and the platform is "android" then
mobileControlSet "mytwentyFirstInputField", "visible", false
else
set the vis of field "docname" to false
end if
put empty into image "libimage"
delete the last image
answer "Finished"
end if
end if
end mouseUp