How to add image from file using code?

Hello, can anyone give me an idea on how to write the code to insert image to existing record in job. For example, I have table A with the records inside. I want to add image to each record. Instead of inserting one by one on the form but I want to run a job to add image at one go since there are many records. I know how to write job to update data but how can i do it for image.

Thank you

Well, it’s fairly simple. You can use the Image class for that:

Image image = new Image();
image.loadImage(_filePath);
. = image.getData();

Thank you Kashperuk…

I made a mistake on the file path. That’s why no photo has been inserted. Already fix it and the picture is inserted successfully.

Hi,

and how can I change in code the path of an image in a report (it depends on a value from a table to use the one ot another image).
Is it possible to write somethong like

if (feld1 == value1)
{
thisreport.image.path = “C:\path\x.png”

}

? Thanks a lot for your help [:)]

How do u test if the a picture is attached to an item in the inventory table. Please help!!!

What is the name of the field where you store the image?

Or the table?

Just check the value of that field is not null. / record in table exists