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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Browse the image from c drive and apply as style definition to selected mashup in a combo

svisveswaraiya
17-Peridot

Browse the image from c drive and apply as style definition to selected mashup in a combo

Hi,

I have a UI in which I have a combo box having 19 mashup names and a browse widget in which I wanted to browse the image from pc and once I selected the image, when I click on apply button I want the selected image to be set as mashup background style for selected mashup from combo.

 

The basic idea is to make the background of mashup as configurable.

 

Please give some idea on how I can achieve this.

 

Thanks,

Shalini V.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello,

You need to create a thing “UploadsRepository”, with thing template “FileRepository”. It will correspond to a simple folder with the same name under your /ThingworxStorage/repositories. See more details in ThingWorx help, I can’t find the right link from the phone. You can use a predefined “SystemRepository” thing just as well, but it’s probably a somewhat cleaner approach to create a separate thing for that (like this you’ll be able to better configure access rights eventually).

/ Constantine

View solution in original post

4 REPLIES 4

Hello,

 

Just my five cents. You can replace MediaEntity content with uploaded content programmatically:

 

var newContent = Things["UploadsRepository"].LoadImage({ path: uploadedPath });
Resources["EntityServices"].UpdateMediaEntity({
    name: 'YourMediaEntityName',
    content: newContent
});

 

But to see the changes the user will have to refresh the page (e.g. CTRL+F5) or wait for quite some time, since ThingWorx caches style definitions.

 

You can probably use MediaEntity's Dynamic Content capability. Unfortunately I've never worked with it myself, so I cannot provide any details on that.

 

/ Constantine

Hi @Constantine ,

Thanks for your response. 

I have a doubt, should I create a thing in which I should be writing a service LoadImage?

Things["UploadsRepository"].LoadImage({ path: uploadedPath });

Could you please clarify this alone?

 

Regards,

Shalini V.

Hello,

You need to create a thing “UploadsRepository”, with thing template “FileRepository”. It will correspond to a simple folder with the same name under your /ThingworxStorage/repositories. See more details in ThingWorx help, I can’t find the right link from the phone. You can use a predefined “SystemRepository” thing just as well, but it’s probably a somewhat cleaner approach to create a separate thing for that (like this you’ll be able to better configure access rights eventually).

/ Constantine

This helped me. Thanks @Constantine.

Top Tags