[英]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.