Hello! How can i store my (or any other user) facebook profile picture on a variable? like a bitmap.
facebook:addEventListener(Event.REQUEST_COMPLETE, function(e)
print(e.response)
end
facebook:graphRequest("me/picture") |
Apparently on request complete I get the image's url, which I could then add to a texture and then create a bitmap. But on e.response I get a gigantic string of weird characters and symbols. So I'm kinda stuck here. Please help
.
Comments
( @ar2rsawseen originally coded this bit, his original code is somewhere on the forum )
https://deluxepixel.com
I get an error when trying to load the images .
This is my output (I changed the id to 222):
Wait, I didn't add the plugin... But I've just enter here http://giderosmobile.com/labs/media and on the left it says: Upgrade to Get it... So I guess I can't use it.
https://deluxepixel.com
I don't really understand that code and I don't know if the image is being wrongly saved or loaded, It would be great to make it work right.
I understand this is what happens when no picture can be found, and that I should create a default picture in case of that.
Likes: jdbc
Likes: somezombiegm
https://deluxepixel.com
I installed a fileviewer and I can see the pictures now, they're always created and they're all in png.
The programm always knows the pictures exist because on the loadFBphoto(id) function:
However,
The thing is, all the profile pictures are getting saved in gideros/myGame/documents. And all my game images are stored in gideros/myGame/resource. I have no problems loading textures from resource.
I guess the solution could be:
- To tell gideros to look on "documents" instead of "resource" when loading a texture?
- Or maybe to create the profile pictures directly on "resource" instead of "documents"?
I'm testing the texture load again
But the images are saved in png
And I'm searching for an image on documents with it's exact name, adding |D| before... So it should've work since the first time I tested the code. =(
that's why in my original code:
http://giderosmobile.com/forum/discussion/comment/33814#Comment_33814
I use pcall, to catch exceptions of incorrect format and load default image instead
https://deluxepixel.com
I added the loadFBphoto function and an aditional one: loadFBphoto2, which doesn't use pcall. With that method we can see the "Image format not supported" error even if the photo is saved on png.
So if you save it as .png it will still be gif and will be incorrect image format just as you get
you just need to use default images in such cases
Likes: somezombiegm
Well, case closed. Thanks to everyone for your help
You could try reading the image data and drawing it as a rendertarget?
https://en.wikipedia.org/wiki/GIF
(if it really is important, but gifs should not be too common)
https://deluxepixel.com
If I used pcall then sucess and texture are nil.
I am not sure that Media plugin converts a JPG to PNG in all cases, I mean Media plugin converts JPG images into PNG format, but not properly.
I got nil |D|1585191695063321.png: Image format is not supported. when pcall is used.
May be somezombiegm has the same problem.
Likes: SinisterSoft