Support of pictures in Objects

From 4D v16 R4, we have added the support of pictures in object attributes. For example, if you use an object to exchange settings or data between methods, forms or processes, now, you can also pass an icon or a picture in this object. You don’t need anymore to temporarily save the picture on disk.

This new type can be used like any other object attribute type: you can use, get and set pictures in objects. You can also use the controls of the picture theme.

Example database

Another use cases for this feature is what we call “User Fieldswhere the field content can be different for a user to another user. For example, you can create a “contact” object. Each user can decide whether he wants to save the “first name”, “last name”, “ID“, “address“, “country“, “gender” information, and so on. Now your users can also save a picture for their contact, easy!

Handling an object attribute

 To set a picture in an object attribute, you can write:

C_OBJECT($obj)
C_PICTURE($Picture)
READ PICTURE FILE("...\Images\avatar.jpg";$Picture)
OB SET($obj;"avatar";$Picture)

 To retrieve a picture attribute in a picture variable, you can write:

C_PICTURE($Avatar)
$Avatar:=OB Get($obj;"avatar")

Manipulating an image

You can use a picture attribute in all the commands of the “Picture” theme. For example:

PICTURE TO BLOB(OB Get($obj;"avatar");$blob;"image/jpeg")

Documentation

For more details, please refer to the following articles in the documentation:

Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.