cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

How to convert uploaded image to base64 and how to convert a base64 to widget

afherrerac
6-Contributor

How to convert uploaded image to base64 and how to convert a base64 to widget

Hello im trying to get a cammera picture from vuforia studio in android but it not seems to work, one of the problems that i have is to transform the base64 data and show it into a widget and visceversa 

 

Thanks 

4 REPLIES 4
ytella
17-Peridot
(To:afherrerac)

Hi @afherrerac ,

What format is the uploaded image? Here is the Link to the supported file formats for the Image widget.

 

It is base64 the case is have downloaded an image via rest api the idea is to show it

Hi @andreherrerac95 ,

 

Could you please share the project with me for testing. I highly appreciate it if you could share the project zip file.

 

Thank you!

Hi @andreherrerac95 ,

the received data is base64 so you do not need to encode it.  For pictures some thing like this:

 

$http(req).then(
function(response) 
  
  { //here you need to pay attention about the correct type jpg, gif, png 
    var ret_str='data:image/gif;base64,'+response.data.rows[0].Content;
     console.warn(ret_str);
     $scope.view.wdg[image_id]['imgsrc']=ret_str; //2d image
//  $scope.view.wdg[image_id]['src']=ret_str; //3d image
     }, 
function(response){;}
               );
};

 

So this is all. you need to set the src /imgsrc for 3d/2d images property of the image widget

Announcements

Top Tags