Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hi, Carles Coll
I have a requirement where I need to set logged in user's image (Avatar) so that user can change his/her profile pic when he/she logged in.
I uploaded an image file in SystemRepository by using FileUpload widget. Now I want to get this image as a object in a service so that I can use this image to create an Avatar.
I don't know how can I load this image from SystemRepository via a service's script (javascript) and then set it as logged in user's Avatar.
Please help me regarding the same.
Regards,
Rohit Kumar Jaiswal
On user's available services you have a SetAvatar which accepts an Image object, and on FileRepository you have a LoadImage service which returns an Image Object, if you join both I think you will be able to do it
Hi Carles,
when I set avatar of an User via SetAvatar service then I am getting Wrapped javax.imageio.IIOException: Can't create cache file! Cause: Can't create cache file!
error.
Please help me
Code Snippet::
var params = {
path: FullPath /* STRING */
};
// result: IMAGE
var imageContent = Things["SystemRepository"].LoadImage(params);
var params = {
content: imageContent /* IMAGE */
};
// no return
Users[currentUser].SetAvatar(params);
Seems ok, maybe better you open a support case, maybe it's a memory problem ( the image it's big?)