繁体   English   中英

在Livecode中,如何上传运行应用程序的设备上的图像?

[英]In Livecode, how do you upload images that are on the device the app is running on?

如果该应用程序在iPad上,您将如何检索该iPad上的图像?

以下是我的一个项目。 它应该像那样工作。

function rescale theImgWidth,theImgHeight,theCdWidth,theCdHeight
  if theCdWidth/theImgWidth < theCdHeight/theImgHeight then
    put theCdWidth / theImgWidth into myRatio
  else
    put theCdHeight / theImgHeight into myRatio
  end if
  put theImgWidth * myRatio into myNewWidth
  put theImgHeight * myRatio into myNewHeight
  return myNewWidth,myNewHeight
end rescale

on pickPhoto
     set the visible of the templateImage to false
     if the environment is "mobile" then
          mobilePickPhoto "library"
          put the result into rslt
          if rslt is "Cancel" then 
               exit pickPhoto
          else
               if there is an image "Photo" then
                    delete image "Photo"
               end if
               put the long id of the last img into myImage
               set the name of myImage to "Photo"
          end if
     else
          answer file "Choose a picture..." with type "GIF|gif|GIFf" or type "JPEG|jpg,jpeg|JPEG" or type "PNG|png|PNGf" or type "All files|*|*"
          put the result into rslt
          if the result is "Cancel" or it is empty then 
               exit pickPhoto
          else
               put it into myFile
               if there is an image "Photo" then
                    delete image "Photo"
               end if
               create image "Photo"
               set the filename of it to myFile
               put it into myImage
          end if
     end if
     if there is a myImage then
          put rescale(the formattedWidth of myImage,the formattedHeight of myImage,the width of this cd,the height of this cd) into myWH
          set the width of myImage to item 1 of myWH
          set the height of myImage to item 2 of myWH
          set the loc of myImage to the loc of this cd
          show myImage
     end if
end pickPhoto

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM