Skip to main content
Best answer by cmorfin

Hi @InfinityX 

 

The problem is still with the path setting.

You are using 

Things["SystemRepository"].LoadImage(paramsLoadImage);

this means that the FileRepository SystemRepository is used to load image.

This FileRepository is only going to look inside its root folder and nowhere else on the machine, so the path needs to be relative to this root folder.

Based on what you wrote your SystemRepository is pointing to C:\Program Files (x86)\ThingWorxPostgres-8.4.8\ThingworxStorage\repository\SystemRepository. So this is where 

Things["SystemRepository"].LoadImage(paramsLoadImage); is going to look for data.

The path specified in paramsLoadImage needs to be something inside this folder.

Specifying the full path as you did does not work.

If your image file is directly under C:\Program Files (x86)\ThingWorxPostgres-8.4.8\ThingworxStorage\repository\SystemRepository, then path should simply be the image file name, for example image.png.

The path needs to point to the file itself not the parent folder.

 

The imageName is the name that will be displayed in Composer for this Media entity, it has not got to be the same as filename, but path does need to point to the filename.

 

I hope that clarifies it.

Regards

Christophe

 

1 reply

19-Tanzanite
March 16, 2020

Hi @InfinityX 

 

Something that would give this error is you enter incorrect value for imagePath .

imagePath  should be relative to the Repository you are using.

For example if you have mypic.jpg sotred under SystemRepository, imagePath  should be mypic.jpg only.

 

Hope this helps

Christophe

 

 

InfinityX1-VisitorAuthor
1-Visitor
March 16, 2020

Yes,

I tried with the help of file upload widget, it's working. But as I tried with other file location defined in the service getting error for location of file.

So, What should I do for other location image file to show on mashup.

My requirement is to show the single images for 3 second on image widget, after 3 second next image will show. 

19-Tanzanite
March 16, 2020

Hi @InfinityX 

The code you referred to at https://community.ptc.com/t5/ThingWorx-Developers/How-to-load-the-image-into-thingworx-storage-media-dynamically/td-p/565635  does require the file to be present under a ThingWorx FileRepository.

I don't think you can show files outside a filerepository, would be a potential security issue.

 

Regards

Christophe