Page 1 of 1

Naming photo from library

Posted: Sat Sep 12, 2015 7:28 pm
by chelling
I am hoping someone can help me. I am trying to import an image from the iOS camera roll library. This button script works fine except for the namePhoto part. It's as if it's not running. I am testing it in the simulator. I have tried to call it from the card script, place it within the else section, and as shown after the else/end if statements. I also added a wait 0 milliseconds with messages after the end if. It's important that the user be able to name the photo. Thanks!

on mouseUp
set the icon of me to 2228
mobilePickPhoto "library", 640,480
if the result is "cancel" then
answer "No picture selected"
else
if there is an image "photoPreview" then
delete image "photoPreview"
end if
set the name of last image to "photoPreview"
wait 10 milliseconds
set the rect of image "photoPreview" to the rect of card button "imageHolder"
set the loc of image "photoPreview" to the loc of card button "imageHolder"
set the visible of image "photoPreview" to true
set the bottom of image "photoPreview" to the bottom of button "photoLocator"
end if
namePhoto
end mouseUp


on namePhoto
ask "Please name your photo"
put it into tName
put tName into field "fImageName"
end namePhoto

Re: Naming photo from library

Posted: Mon Sep 14, 2015 9:43 am
by jmburnod
Hi chelling,

Your namephoto command doesn't rename imported img.
You have to rename it and delete img if user chooses "cancel" after ask dialog

Code: Select all

on namePhoto
   ask "Please name your photo"
   if it = empty then 
      delete img "photoPreview"
      exit namePhoto
   end if
   put it into tName
   put tName into field "fImageName"
   set the name of img "photoPreview" to it
end namePhoto
Best regards

Jean-Marc

Re: Naming photo from library

Posted: Wed Sep 16, 2015 12:22 am
by chelling
Thank you so much for your help Jean-Marc! I just couldn't get it worked through.