In my app, the user chooses an image from their mobile device (android in this case) - so I am using mobilepicklibrary. I think you have to set the templateimage size before the person picks the image. But then if the image is larger than your original settings, the image is all distorted. So, I tried resizing it after it came in (since I don't know what they're going to pick before mobilepicklibrary).
I wasn't successful changing the original templateimage after an image was imported, so I thought I could create a second image with the correct size and bring the first image into it.
Nice idea...but it isn't working.
I can get the ratio (which is confusing - because Androids seem to display their images sideways, so their length is my width...anyway...that's why the formula below is backwards...) But now the new image is just the full size - a big mess on the screen. - it seems to ignore all my settings (top, left, width, etc).
And while I'm at it -if this image is saved or ftp'd, what sizes are being saved? the original size before mobilepicklibrary, the one in the original template, or the one that I theoretically resized?
I found some info that lets the user resize the image (with a stack called: stresizeimage.livecode), but it was all based on reading a .png file. I will usually have .pngs - but not necessarily - so the solution isn't matching what I need.
Here is my code
Code: Select all
if the environment is "mobile" then
//sets loc/size of image on stack
set the lockloc of the templateimage to true
set the width of the templateimage to "200"
set the height of the templateimage to "350"
set the left of the templateimage to "130"
set the top of the templateimage to "445"
// select image from phone image library
mobilepickphoto "library"
// names image "libimage"
set the name of last image to "libImage"
put the formattedwidth of last img into ttWidth
put the formattedheight of last img into ttHeight
put ttheight/ttwidth into tratio
set the width of image "templateimage3" to "100"
set the height of image "templateimage3" to 100*tratio
set the left of image "templateimage3" to "230"
set the top of image "templateimage3" to "225"
put image "libImage" into image "templateimage3"
end if
answer "done"