Redirected URL for image not working in createImageView

You must Login before you can answer or comment on any questions.

I am working in an app which receives image from a server through a URL.

The image didn't load in the imageView but worked fine when I used webView.

var imageView = Ti.UI.createImageView({

image:imageURL,

    height:320,

 width:320,

    top:30

});

//webview var imageWebView = Ti.UI.createWebView({ url:imageURL

});

When i tried the same URL in the browser, it redirected to another URL and displayed the image from there.

So, I tried with the redirected image URL inside the app which worked fine.

But I cant receive the redirected URL from server which looks far different from the direct URL.

Any fix for this solution ?

1 Answer

can just download the images to temp files and then point the imageView to the temp files to the

— answered 2 years ago by Aaron Saunders
answer permalink
3 Comments
  • thats not getting downloaded to the temp file too ..

    I tried that method which I usually do ..

    Any other solution ?

    — commented 2 years ago by Primoris online

  • did you check for the redirect code is the status and then download the redirected URL?

    the status code would be 301, and the responseHeader should have a location value with the new URL

    — commented 2 years ago by Aaron Saunders

  • it makes sense ..but amn't sure about what to do..

    When I send the request I receive a JSON (on xhr.status == 200) like

    21123:{

    id:'123'

    imageurl:http://ch.jjhoji0oww

    musicurl:http://sdhkjslljsasds

    }

    I give the image URL to

    var imageView = Ti.UI.createImageView({ image:imageURL, http://ch.jjhoji0oww }

    The image view is blank.

    In the browser it is redirected to http://*//coverImage/kjhjdhfoejrk0922

    Where to get the status code, responseHeader and other things.

    Kindly give a solution ?

    — commented 2 years ago by Primoris online

Your Answer

Think you can help? Login to answer this question!