You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As title,
I need the array bytes/base64 of image to upload it to server, but i can't find any solution yet.
I tried CCImage.getData() in JSB but return null.
I'm using this custom Image Picker to get the image from photo album.
It successfully created CCSprite with the return texture. #11344
After get the array bytes/base64 of image, i need to use it in JSB with Cocos2d-JS.
Thanks.
The text was updated successfully, but these errors were encountered:
@Zinitter
You might need to maintain a key-value map of texture file name and texture.
Every time you want to get the Image of Texture, you could use this map to query the texture file name and create CCImage with this name.
Are you suggesting me to maintain a key-value map of texture so i can recreate the CCImage?
Then does the CCImage.getData() can return the image array bytes?
I have tried modified the ImagePicker to return CCImage instead of texture and tested it with the JSB in Cocos2d-JS
var texture = new cc.Texture2D();
texture.initWithImage(returnCCImage);
var sprite = new cc.Sprite(texture);
cc.log("data : " + returnCCImage.getData());<-- this show null on log
The sprite can be created and show properly on Mac and iOS with the return CCImage.
The Android show a black sprite but size of sprite it correct, not sure my modification is correct or not.
returnCCImage.getData() on Mac and iOS showing null and Android will crashed.
Am i doing something wrong or is the bug on the CCImage.getData()?
As title,
I need the array bytes/base64 of image to upload it to server, but i can't find any solution yet.
I tried CCImage.getData() in JSB but return null.
I'm using this custom Image Picker to get the image from photo album.
It successfully created CCSprite with the return texture.
#11344
After get the array bytes/base64 of image, i need to use it in JSB with Cocos2d-JS.
Thanks.
The text was updated successfully, but these errors were encountered: