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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Image file to IMAGE basetype

Sathishkumar_C
17-Peridot

Image file to IMAGE basetype

Started developing extension to get image file from windows file explorer. 

 

  • Created resource
  • Created service [input: imagePath, output: IMAGE]

Here how to convert Imge file to thingworx IMAGE basetype?

1 ACCEPTED SOLUTION

Accepted Solutions

Got solution with by converting image file into Base64 String.

String base64String = null;
File imageFile = new File(imagePath);
byte[] fileContent = FileUtils.readFileToByteArray(imageFile);
String encodedString = Base64.getEncoder().encodeToString(fileContent);
base64String = encodedString;

View solution in original post

2 REPLIES 2

Hi,

 

Following link may be helpfull

How-to-load-the-image-into-thingworx-storage-media-dynamically 

 

 

Hope this helps!!

Got solution with by converting image file into Base64 String.

String base64String = null;
File imageFile = new File(imagePath);
byte[] fileContent = FileUtils.readFileToByteArray(imageFile);
String encodedString = Base64.getEncoder().encodeToString(fileContent);
base64String = encodedString;
Top Tags