x


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); 
    }
}
more ▼

asked Mar 31, 2011 at 04:08 PM

peter gravatar image

peter
381 100 75 77

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!!

Apr 01, 2011 at 03:43 PM peter
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Prepend the url with file://

more ▼

answered Mar 31, 2011 at 04:42 PM

DaveA gravatar image

DaveA
33.3k 416 335 442

Oh master Jedi, the force is very strong with you and you are correct!

Thx so much!!!

Mar 31, 2011 at 08:51 PM peter
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x804
x31
x25

asked: Mar 31, 2011 at 04:08 PM

Seen: 3467 times

Last Updated: Mar 31, 2011 at 04:08 PM