Page 1 of 1

Scaling the photo from mobilePick

Posted: Sun Apr 15, 2012 2:10 pm
by bcreitz
I'm a complete beginner. I'm playing with the LC Lesson for mobile cameras on an Android device. After I take the picture, it appears on my card at 100% scale. I can't seem to resize it after that. The code below...

Code: Select all

on mouseUp
   mobilePickPhoto "camera"
   if the result is text then
      put the result into image "The_Image"
      set the width of img "The_Image" to 200
      set the height of img "The_Image" to 200
   else
      put the result into field "The_Result"
   end if 
end mouseUp
... doesn't do it for me.

Any advice?

Thanks!

Ben

Re: Scaling the photo from mobilePick

Posted: Sun Apr 15, 2012 3:05 pm
by Klaus
hi Ben,

from the ANDROID Release Notes on "MobilePickPhoto":
...
Note:
The image object is cloned from the templateImage, so you can use this to configure settings before calling the picker.
...

"the templateimage" is exactly what it says, it is the "virtual" template from that newly created images are derived.
So if you set the widht/height and NAME! of the template image first, your script will work.

AND "the result" will coantain an error or "Cancel", too, if the user cancelled or there was any error,
but "thre result" will be empty on success!

So try this:

Code: Select all

on mouseUp
   set the name of the templateimage to "The_Image"
   set the width of the templateimage to 200
   set the height of the templateimage to 200

   # Now this will produce a new image named "The_Image" in 200*200 pixels on the current card!
   mobilePickPhoto "camera"

  ## Now check for errors!
   if the result<> EMPTY then
      put the result into field "The_Result"
   end if 

  ## Always a good idea to RESET your modified TEMPLATRE stuff!
  reset the templateimage
end mouseUp
And welcome to the forum :)

Best

Klaus

Re: Scaling the photo from mobilePick

Posted: Mon Apr 16, 2012 7:42 pm
by bcreitz
Thank you Klaus, I can't wait to try this.

Ben

Re: Scaling the photo from mobilePick

Posted: Sat Jun 16, 2012 9:20 am
by Chipp
I suspect you'll also need to add:

set the lockloc of the templateImage to true

And, you'll want to make sure the width and height are proportion to the image before you lockloc it.

Re: Scaling the photo from mobilePick

Posted: Sat Jun 16, 2012 1:21 pm
by Klaus
Yes :)