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.
Another use cases for this feature is what we call “User Fields” where 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: