为了获取平台玩家头像
需要访问外部服务器上的图片
建立了一个中转服务器
代码如下
请求资源代码为
请求了3个远程图片
LOG显示为
-
- ready to request remote image: http://192.168.1.117:8080/TravalHamster/IconBridge.php/?url=https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1542885958212&di=9cd495ce8340ced418be52b9689ffab8&imgtype=0&
-
- ready to request remote image: http://192.168.1.117:8080/TravalHamster/IconBridge.php/?url=http://zw-resource.oss-cn-shenzhen.aliyuncs.com/userpic_path/864274031766245215771436032.png
-
- ready to request remote image: http://192.168.1.117:8080/TravalHamster/IconBridge.php/?url=http://zw-resource.oss-cn-shenzhen.aliyuncs.com/userpic_path/867919021375327216906902390.png
-
- string
- data type is Texture2D ? :false
- http://192.168.1.117:8080/TravalHamster/IconBridge.php/?url=https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1542885958212&di=9cd495ce8340ced418be52b9689ffab8&imgtype=0& load complete!
- Error: DOMException: Failed to execute ‘open’ on ‘XMLHttpRequest’: Invalid URL
- cocos2d-js-for-preview.js:23488
-
at 139.module.exports (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:23488:10)
-
at 130.Downloader.handle (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:22569:31)
-
at flow (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:23304:26)
-
at flow (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:23322:17)
-
at 137.proto.flowIn (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:23377:10)
-
at 134.proto.append (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:23030:84)
-
at 124.proto.load (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:21844:12)
-
at loadImage (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:46240:18)
-
at _loadTexture (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:11271:36)
-
at setTexture (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:11264:15)
-
at (anonymous) (d:\Html5\trunk\WaterMelonTales\assets\coffee_bean\expand\CSprite.ts:44:30)
-
at (anonymous) (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:21834:31)
-
at (anonymous) (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:31489:10)
-
- object
- data type is Texture2D ? :true
- http://192.168.1.117:8080/TravalHamster/IconBridge.php/?url=http://zw-resource.oss-cn-shenzhen.aliyuncs.com/userpic_path/864274031766245215771436032.png load complete!
-
- object
- data type is Texture2D ? :true
- http://192.168.1.117:8080/TravalHamster/IconBridge.php/?url=http://zw-resource.oss-cn-shenzhen.aliyuncs.com/userpic_path/867919021375327216906902390.png load complete!
3个图片都可以直接点开看到效果
但是第一个图片请求下来的为字符串
同时设置的时候会报错
此外第2,第3个图片虽然下载成功
但显示到游戏中为并没有显示完全的状态
依稀可以辨认好像是我的图集文件
求大神解惑!!!
感激不尽