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: FourthWorld, heatherlaine, Klaus, kevinmiller

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

Re: Image Problems

Post by Quinton B. » Mon Jun 24, 2019 2:37 am

Everything works amazing. Thanks everyone. Here is the code:

Code: Select all

on mouseUp
   answer question "Take a Picture or Choose a Photo" with "Cancel" or "Take" or "Choose"
   if it = "Choose" then
      answer file "Choose an image file to import"
      if the result = "cancel" then
         exit mouseUp
      else
         put it into PATEKA
         set the height of image "The_Image" to 250
         set the width of image "The_Image" to 250
         if PATEKA is not empty then
            set the filename of img "The_Image" to PATEKA
            set the lockscreen to true
            set the name of the last control to "The_Image"
            put the width of img "The_Image" into WIDD
            put the height of img "The_Image" 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 "The_Image" to nWIDD
               set the height of img "The_Image" to nHITE
            else
               put 250 into nWIDD
               put HITE/WIDD into sFACTOR
               put 250*sFACTOR into nHITE
               set the width of img "The_Image" to nWIDD
               set the height of img "The_Image" to nHITE
            end if
         end if
      end if
   end if
   if it = "Take" then
      mobilePickPhoto "camera", 250, 250
      if the result = "cancel" 
      then
         exit mouseUp
      else
         put it into PATEKA
         set the height of image "The_Image" to 250
         set the width of image "The_Image" to 250
         if PATEKA is not empty then
            set the filename of img "The_Image" to PATEKA
            set the lockscreen to true
            set the name of the last control to "The_Image"
            put the width of img "The_Image" into WIDD
            put the height of img "The_Image" 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 "The_Image" to nWIDD
               set the height of img "The_Image" to nHITE
            else
               put 250 into nWIDD
               put HITE/WIDD into sFACTOR
               put 250*sFACTOR into nHITE
               set the width of img "The_Image" to nWIDD
               set the height of img "The_Image" to nHITE
            end if
         end if
      end if
   end if
   if it = "Cancel" then
      exit mouseUp
   end if
end mouseUp

Post Reply