Image Problems

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Image Problems

Post by Quinton B. » Mon May 13, 2019 1:00 pm

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

Klaus
Posts: 11333
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Image Problems

Post by Klaus » Mon May 13, 2019 1:28 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3834
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Image Problems

Post by richmond62 » Mon May 13, 2019 2:08 pm

I've always had problems with my image: ask Klaus.

Klaus
Posts: 11333
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Image Problems

Post by Klaus » Mon May 13, 2019 2:09 pm

So true! :D :D :D

Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Re: Image Problems

Post by Quinton B. » Sat Jun 08, 2019 10:23 pm

So there is no way to contain the image the user selected within the image widget, instead of creating an image on the card?
Attachments
Register_Image.PNG

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3834
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Image Problems

Post by richmond62 » Sat Jun 08, 2019 11:27 pm

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:
-
Image Getter.png
Last edited by richmond62 on Sun Jun 09, 2019 12:04 pm, edited 2 times in total.

Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Re: Image Problems

Post by Quinton B. » 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?

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2400
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Image Problems

Post by jmburnod » Sun Jun 09, 2019 9:40 am

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3834
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Image Problems

Post by richmond62 » Sun Jun 09, 2019 12:01 pm

The image the end-user selects will automatically fill the frame image:
-
fioch.png
-
fioch2.png
-

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3834
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Image Problems

Post by richmond62 » Sun Jun 09, 2019 12:03 pm

groovy.png
groovy.png (79.78 KiB) Viewed 986 times
-
groovyPurple.png
-
You too can have a Silly Sunday. 8)
Attachments
Image Getter.livecode.zip
Stack
(30.56 KiB) Downloaded 22 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3834
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Image Problems

Post by richmond62 » Sun Jun 09, 2019 12:06 pm

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.

Klaus
Posts: 11333
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Image Problems

Post by Klaus » Sun Jun 09, 2019 12:19 pm

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)? 8)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3834
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Image Problems

Post by richmond62 » Sun Jun 09, 2019 12:27 pm


Klaus
Posts: 11333
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Image Problems

Post by Klaus » Sun Jun 09, 2019 1:12 pm

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
:D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3834
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Image Problems

Post by richmond62 » Sun Jun 09, 2019 1:35 pm

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
-
Image Scaler.livecode.zip
(244.41 KiB) Downloaded 22 times
Attachments
Image Scaler.livecode.zip
Here's the stack
(244.41 KiB) Downloaded 24 times

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”