Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
UserBB33
Posts: 32
Registered: ‎05-05-2011
My Device: BB9700
My Carrier: mts
Accepted Solution

Problem in Displaying image from server.

Hi,

I'm trying to get an image data from the server(base64 encoded) and diaplay the image in my webpage using div. This works fine from the web browser. But when i compile it to a webworks application the image doesnot display at all. What am i missing? PFB the JavaScript code of how i set the image from the server.

 

var testObject = testHTTP.responseText.parseJSON();
var image = testObject.SearchImageResponse.images;
document.getElementById("test").innerHTML = "<img src='data:image/jpeg;base64,"+image+"' />";

Please note: That this works fine in IE

 Thanks in Advance....

Please use plain text.
Contributor
UserBB33
Posts: 32
Registered: ‎05-05-2011
My Device: BB9700
My Carrier: mts

Re: Problem in Displaying image from server.

Anybody?
Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Problem in Displaying image from server.

This may be a problem in our URL whitelisting... I've seen this before, I'll ping our development and testing team to see if this is a known issue

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Contributor
kam1loherrera
Posts: 19
Registered: ‎06-14-2011
My Device: 9300
My Carrier: Comcel

Re: Problem in Displaying image from server.

Is your server IP authorized on your domain list (config.xml)?, if not add it (check subdomain access too just in case), this will fix it, if not try using jsonp instead. Remember that if the IP of your server doesn´t change then you can just whitelist it on your config, if it changes (ie. the user can change the IP from the app) then add "*", but this will ONLY work for public IPs.

Please use plain text.
Contributor
UserBB33
Posts: 32
Registered: ‎05-05-2011
My Device: BB9700
My Carrier: mts

Re: Problem in Displaying image from server.

Hi all..
Thanks for all your replies. i have got a very wierd solution for this problem. When i compile the application using Eclipse the images are getting diaplyed. But when I complie it using ant (Phonegap). The images are not getting displayed. So To solve this. I added Phonegap Javascript Extenion in Eclipse and starting working that way.
Hope this helps some one who is frustrated searching for this issue.
Please use plain text.
Contributor
kam1loherrera
Posts: 19
Registered: ‎06-14-2011
My Device: 9300
My Carrier: Comcel

Re: Problem in Displaying image from server.

Thanks!, you should mark your post as the solution.

Please use plain text.
Contributor
UserBB33
Posts: 32
Registered: ‎05-05-2011
My Device: BB9700
My Carrier: mts

Re: Problem in Displaying image from server.

Done Kam1loherrera :smileyhappy:
Please use plain text.