Page 1 of 2
Image Problems
Posted: Mon May 13, 2019 1:00 pm
by Quinton B.
I'm trying for the image that I select from my mobile library to be put neatly into an image, but it doesn't work correctly, this is what happens:
https://drive.google.com/file/d/1hUzT_n ... sp=sharing
Code: Select all
on mouseUp
# the X, Y dimensions for an image are not supported on Android and are ignored
mobilePickPhoto "library"
if the result is text then
put the result into image "The_Image"
end if
end mouseUp
Re: Image Problems
Posted: Mon May 13, 2019 1:28 pm
by Klaus
Hi Quinton,
from the dictionary, which is really better than its reputation, about "mobilepickphoto":
...
If the user cancels the pick, the command returns with result cancel.
Otherwise a new image object is created on the current card of the
default stack containing the chosen image.
...
Best
Klaus
Re: Image Problems
Posted: Mon May 13, 2019 2:08 pm
by richmond62
I've always had problems with my image: ask Klaus.
Re: Image Problems
Posted: Mon May 13, 2019 2:09 pm
by Klaus
Re: Image Problems
Posted: Sat Jun 08, 2019 10:23 pm
by Quinton B.
So there is no way to contain the image the user selected within the image widget, instead of creating an image on the card?
Re: Image Problems
Posted: Sat Jun 08, 2019 11:27 pm
by richmond62
I'm not sure exactly what you mean because in your first message you
seem to be writing about setting an imageSource for an image, but in your
most recent post you write about an image widget.
It should be very simple indeed for an end-user to select an image and have that displayed
inside an image object.
I have no idea what an image widget is.
Have a play with this:
-
Re: Image Problems
Posted: Sun Jun 09, 2019 1:15 am
by Quinton B.
Lol, well your way works. How do you resize the image to a certain size such as 250px x 250px?
Re: Image Problems
Posted: Sun Jun 09, 2019 9:40 am
by jmburnod
Hi Quinton,
I guess you want to resize an image proportionally
There is a lesson here
http://lessons.livecode.com/m/4071/l/15 ... e-an-image
Best regards
Jean-Marc
Re: Image Problems
Posted: Sun Jun 09, 2019 12:01 pm
by richmond62
The image the end-user selects will automatically fill the frame image:
-
-
-
Re: Image Problems
Posted: Sun Jun 09, 2019 12:03 pm
by richmond62

- groovy.png (79.78 KiB) Viewed 8433 times
-
-
You too can have a Silly Sunday. 
Re: Image Problems
Posted: Sun Jun 09, 2019 12:06 pm
by richmond62
And it will be pretty silly as most images are going to get distorted . . .
The main difficulty is knowing the dimensions of the image the end-user will select.
Re: Image Problems
Posted: Sun Jun 09, 2019 12:19 pm
by Klaus
Quinton B. wrote: ↑Sun Jun 09, 2019 1:15 am
Lol, well your way works. How do you resize the image to a certain size such as 250px x 250px?
Apply a "rule of three" (a.k.a. rule of proportion)?

Re: Image Problems
Posted: Sun Jun 09, 2019 12:27 pm
by richmond62
Re: Image Problems
Posted: Sun Jun 09, 2019 1:12 pm
by Klaus
I prefer this quote:
...
And the Lord spake, saying, "First shalt thou take out the Holy Pin.
Then, shalt thou count to
three. No more. No less.
Three shalt be the number thou shalt count, and the number of the counting shall be
three.
Four shalt thou not count, nor either count thou two, excepting that thou then proceed to
three.
Five is right out. Once the number
three, being the third number, be reached, then, lobbest thou
thy Holy Hand Grenade of Antioch towards thy foe, who, being naughty in My sight, shall snuff it."
...
From "Holy Hand Grenade of Antioch"
https://www.youtube.com/watch?v=ashgP4YMdJw

Re: Image Problems
Posted: Sun Jun 09, 2019 1:35 pm
by richmond62
If the end-user imports their chosen picture into the stack,
rather than just referencing it, scaling it proportionally is fairly easy:
Code: Select all
on mouseUp
if exists(img "XYZ") then
delete img "XYZ"
end if
answer file "Select image:"
if the result is not cancel then
set the lockscreen to true
import paint from file it
set the name of the last control to "XYZ"
put the width of img "XYZ" into WIDD
put the height of img "XYZ" into HITE
if WIDD < HITE then
put 250 into nHITE
put WIDD/HITE into sFACTOR
put 250*sFACTOR into nWIDD
set the width of img "XYZ" to nWIDD
set the height of img "XYZ" to nHITE
else
put 250 into nWIDD
put HITE/WIDD into sFACTOR
put 250*sFACTOR into nHITE
set the width of img "XYZ" to nWIDD
set the height of img "XYZ" to nHITE
end if
end if
end mouseUp
-