- Home /
Grab image and display on plane
How do I grab image from my documents path and display on plane on IOS? This code results in a ? on the plane. My path works perfect with a web view within the app and it is also successfully saving the screen capture in the photo library(camera roll). I'm using Prime31 Plugin. Thx for any help!!!!!!
function ScreenCapture(){ EtceteraBinding.takeScreenShot("image1.png"); EtceteraBinding.saveImageToPhotoAlbum(GetDocumentsPath()+"image1.png");
} function GetDocumentsPath() : String{ var DocumentsPath : String; DocumentsPath = Application.dataPath.Substring (0, Application.dataPath.Length - 5); DocumentsPath = DocumentsPath.Substring(0,DocumentsPath.LastIndexOf("/")); return DocumentsPath + "/Documents/"; }
function Start () { ScreenCapture(); var go = new GameObject.CreatePrimitive(PrimitiveType.Plane); var url = (GetDocumentsPath()+"image1.png"); go.renderer.material.mainTexture = new Texture2D(50, 50, TextureFormat.RGB24, false); while(true) { // Start a download of the given URL var www = new WWW(url);
// wait until the download is done
yield www;
// assign the downloaded image to the main texture of the object
www.LoadImageIntoTexture(go.renderer.material.mainTexture);
}
}
Is there a way to put all images in their own album? If files are named the same, does the device auto assign an index number or something....Thx a bunch!!
Answer by DaveA · Mar 31, 2011 at 04:42 PM
Prepend the url with file://
Oh master Jedi, the force is very strong with you and you are correct!
Thx so much!!!
Hi, I know this is an old thread but what do you mean by 'Prepend the URL with file://'? Could you perhaps give an example? Thanks
Your answer
Follow this Question
Related Questions
Unity accessing to gallery photo of android device 2 Answers
How to detect file type loaded from device local storage 1 Answer
Photo image/gallery 0 Answers
Unity UI photo gallery 0 Answers