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

时间:2014-12-05 19:25:07

标签: image livecode

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

1 个答案:

答案 0 :(得分:0)

以下是我的一个项目。它应该就是这样。

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