Results 1 to 3 of 3
  1.    #1  
    If I have the binary data of an image, how would I display it?

    I'm looking for something like this: Q955 Can I manipulate images a pixel at a time?

    I've recieved the image via Ajax (or XMLHttpRequest) and thus have the actual image's data. but I can't save it to the device and then show that, so I need to just display the binary data as an image in the scene.
  2. mosdl's Avatar
    Posts
    781 Posts
    Global Posts
    787 Global Posts
    #2  
    You need to look at the <canvas> tag - https://developer.mozilla.org/En/Can...l/Using_images for example.
    Apps: MyQ for Netflix (Phone/TouchPad), Giantbomb (Phone), Excavate (Reddit/Digg clients for TouchPad)
  3.    #3  
    Quote Originally Posted by mosdl View Post
    You need to look at the <canvas> tag - https://developer.mozilla.org/En/Can...l/Using_images for example.
    I apolgize if I'm just not getting this but my code's not working. The image just shows as a small empty box. What am I doing wrong?

    Code:
    //First thing I do is use Ajax to get the image file's data
    
    //Next, it calls my content handler method (see below):
    
    FirstAssistant.prototype.handleContent = function(content)
    {
            //This just does (& 255) with each character in the content stream
            //But even without converting it, it still does not work
    	var newImg = this.convertBinary( content );
    	var img = new Image();
    	img.src = "data:image/png;base64," + Base64.encode( newImg );
    	
    	//this appends an img, but it's empty
            this.controller.get("mydiv").appendChild( img );
    }
    Do I have the content's format wrong? Is it already in base64? Is there something else I'm missing?

Posting Permissions