Cocos2d-js 3.6.1 Load image from URL

@Zinitter thanks for helping. Did you download from FB? Just to make sure.

@StudioAMK

No, i didnā€™t try with FB as i didnā€™t integrate FB in my project.

So i just try it with my app on Mac, tested with http and https image url on same server.

Thanks again!

May be you can try this link http://graph.facebook.com/166/picture

Just to confirm FB issue and SSL issue.

@StudioAMK

Tested, url redirect not working, https not working.

However, the url after redirect of http://graph.facebook.com/166/picture, replace https with http is working.

You can report the issue on GitHub.

Meanwhile, you can try study about the libCurl or try to get the url after redirect, then replace https with http to make it work as a temporarily solution.

1 Like

@Zinitter, @StudioAMK, I do not directly use textureCache.addImageAsync, but I use loader.loadImg, which in native actually returns a cc.Texture2d that has already been added to the textureCache.

But for it to handle HTTPS requests, I had to resort to using network::HttpClient instead of the default extension::Downloader.

How did I personally do it? /frameworks/js-bindings/bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp has the JSDownloaderDelegator class. I modified its constructor internally to detect if the url starts with ā€œhttpsā€, and instead use network::HttpClient to handle such cases.

I used the answer to this other thread as an example. Or you could follow the steps in there, up to you. The important thing is what I highlighted above.

1 Like

@Ruluk Awesome Tipsā€¦ I will try and get back to youā€¦ Thanks a million!!! :slight_smile:

I think, itā€™s too much to ask forā€¦ But, if you could share the modified code file(s) for HTTPS, we would be so gladā€¦ Thank you very much againā€¦