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

I need help~!!! How to upload a local image file to be a MediaEntity by a service?

kqian-2
1-Visitor

I need help~!!! How to upload a local image file to be a MediaEntity by a service?

How to upload a local image file to be a MediaEntity by a service?

3 REPLIES 3
gallan
4-Participant
(To:kqian-2)

Where are you loading the Image from?  If you can generate access it via a URL you can use

var params = {

  tags: undefined /* TAGS */,

     ...

  timeout: undefined /* NUMBER */

};

Resources["ContentLoaderFunctions"].LoadMediaEntity(params);

If the image is associated with a thing you can store it in a property of type image or the Avatar and then upload the image via a Repository using the FileUpload widget.

If you want to store multiple images I'd suggest a Data Table as I don't think you should be  using Media Entries for dynamic data

Can you give some more background/say what you have tried so far?

kqian-2
1-Visitor
(To:gallan)

Storing the images in Postgre DB to show specific images in mashup by database query(service) is fully able to meet the purpose of the first set.

But the stored data type is bytea (binary data), and I didn't find the solution to convert bytea to image directly in ThingWorx.

Then I tried to store the image locally(such as D:\)and stored the path in DB.But the sourceURL of image widget doesn't support path of image.

So I want to upload local images to be a MediaEntity by a service.

gallan
4-Participant
(To:kqian-2)

I'm not sure how much of an effect using Postgre DB will have but I'm new to TW07.  Is the problem showing the image in a Mashup? if it is you can use a Value Display to show an image in a property.

Can you take a look at this code - It shows an image stored in a property without needing the URL that the Image widget requires

Image Viewer

Announcements


Top Tags