Scaling the photo from mobilePick

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bcreitz
Posts: 6
Joined: Sat Aug 13, 2011 8:33 pm

Scaling the photo from mobilePick

Post by bcreitz » Sun Apr 15, 2012 2:10 pm

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

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Scaling the photo from mobilePick

Post by Klaus » Sun Apr 15, 2012 3:05 pm

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

bcreitz
Posts: 6
Joined: Sat Aug 13, 2011 8:33 pm

Re: Scaling the photo from mobilePick

Post by bcreitz » Mon Apr 16, 2012 7:42 pm

Thank you Klaus, I can't wait to try this.

Ben

Chipp
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 27
Joined: Sat Apr 08, 2006 9:50 am
Contact:

Re: Scaling the photo from mobilePick

Post by Chipp » Sat Jun 16, 2012 9:20 am

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.
[url=http://www.altuit.com/webs/hemingway/Products/AltuitProducts.htm]Visit Altuit, creator of ButtonGadget and other Rev add-ons[/url]

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Scaling the photo from mobilePick

Post by Klaus » Sat Jun 16, 2012 1:21 pm

Yes :)

Post Reply