What data type for Image

0
I have an entity which stores values of a machine like machine ID, name and description. in this entity I want to add an attribute which would store the machine_image. What data type should I choose for a jpeg file to be stored?
asked
3 answers
1

Hi Sushmita,

Create a separate entity that inherits from the system image entity. Then associate this entity to your entity for machine info.

answered
1

Hi Sushmita,

If your entity for Machine only ever needs one picture, then you can have your Machine entity inherit straight from the `System.Image` entity. This inheritance will give your Machine entity all the fields that the `System.Image` entity uses to store data about an image. If you need to storage more than one image, then you should follow Austin's advice above.

 

answered
0

Hi Sushmita,

If you must store the content you could use a Binary Type or Unlimited String and convert the image to a Base64 string.
However, an association between your entity and system.image as Austin suggested is the preferred method.

As a side note, saving images as true files, they are stored on the application node; saving image content as attribute of an entity will store this in the database. Something to consider, based on your specific case.

 

Cheers,

 

John

answered