In your web screens add database images so that they are stored and managed in the OutSystems Platform database.

How to add a Database image:

  1. Insert the Image widget and select its default image

From the Widgets Toolbar, drag the Image widget to your screen canvas, and choose the image in the 'Select Image' window:

    • Select an image from the ones already existing in your eSpace;

    • Click on 'Import Image', choose the image file, to add a new image to your eSpace.

  1. Create an Entity in your eSpace with the following attributes:

    • The entity identifier, Id for example. How?

    • And three more attributes:

      1. An attribute of type Binary for the image itself;

      2. An attribute of Text type for the image filename;

      3. An attribute of Text type for the image file type.

  1. In the Properties window of the Image widget, set the following properties:

    • Type: Set it to Database.

    • Filename: Image file name.

    • Cache: Indicates whether you want to use the cache and how you want to use it. See below for details on using the cache for database images.

    • Entity: Entity that handles the image (the one you have created in the previous step).

    • Attribute: Attribute that handles the image contents. It must be of type Binary data.

    • Id: Attribute that identifies the image. It must be set as an Identifier.

You may speed up the creation of database images and their entities. Learn more about it in Adding Database Images to an Entity and Creating Entities to Store Database Images.

Default Image

The image you select for the Database Image at design time is used as follows:

Cache in Database Images

In order to decrease the accesses to the database and improve performance, the database images can be cached in the Platform Server. You just have to set the Cache property to the maximum duration that the image can be cached.

This property only defines the maximum duration that the image remains in cache; it is possible for the image to remain for less time, but never for longer than the value defined in this property.

See Also

Image Widget Properties | Overview of Images | Using Static Images | Using External Images | Using Background Images | Adding Database Images to an Entity | Creating Entities to Store Database Images