Photo handling

Hi,
I’m using DB to keep the sketch photo. Because it needs to show in Crystal Report and export to Excel by TMS FlexCel component. I want to using file base. Is DA handle that?

Hi,

what do you mean under file base ?

Hi,
That means the table keep the file path only and photo files are keeping in file server.

Hi,

you can keep file path in the DB and send image to client by request (via custom method) or read image and put it to dataset in the Bin2.OnWriteFieldValueEx event on server-side.

in second way, you should declare field as ServerCalculated or include it to SQL like

NULL as "PhotoField"

and set BLOB type for this field.

in the OnWriteFieldValueEx event, you should read image from disk and fill correspondent field.

Hi,
Thanks. I will try it. Any demo for my reference. :sweat_smile:

Hi,

check this sample:
VCLApplication.zip (61.5 KB)

Hi,
Thanks for your example. I tested and have the basic concept about this. But if table has more than 1 photo field, then I need to pass the fieldslist in DataStreamerWriteFieldValueEx. Right?

Hi,

in this event you can check for all photo fields:

    if aField.Name = 'Photo' then begin
       ...
    end
..
    else  if aField.Name = 'Photo9' then begin
       ...
    end;

Hi,
Haha… Yes. I forgot to use this solution. Because I focus on multiple fields that like DataParameterArray.

Thanks again.