Dynamically updated image

RD_Man

Member
Is there a way to dynamically update an image in a standard image object?

I have an OpenEdge Employee entry UI that we want to add an employee photo to. The path for the photo is in the metadata and the photos are on the file system. As each employee record is found, I need to update the image to the found employee.

Thanks,

Mike
 
This is my guess on doing this. First drop an image widget, and load it with a default pic such as one saying no pic available. Then make sure that your image directory is listed in your propath.

and on what ever your procedure is that assigns all the fields to the employee. Have it do this.

DEFINE VARIABLE picLocation AS CHARACTER NO-UNDO.
piclocation = "notepadup.bmp". /*default pic*/
FIND CURRENT employee NO-LOCK NO-ERROR.
IF AVAIL employee THEN
picLocation = employee.PicLocation.
image-1:LOAD-IMAGE(piclocation).


Then on your blank all procedure just have it restore to the default pic.
 
:) dayv2005,

Thank you! Works Great!!! We now have an Employee maintenance view with employee photos. We are also developing a read-only, limited info, "Face-To-A-Name" view for the new employees. This will greatly reduce that nagging question of "Who was that guy/gal?"

Thanks Again,

Mike

P.S. It will also help us developers that do not get out of our cell very often!
 
our cells? LOL i think cells are bigger than my cube haha. And plus you get free lunches in cells :).

Glad i could be of help.
 
We are converting from a system that did not have the BLOB capabilities to Progress. I did not realize that was an option.

Is the TO and FROM a BLOB field very tricky?
 
I told you about the blob field because the file system can be easily erased I mean, keep all data together is more safe than having some data in the DB and the reset in the file system......well, I'm not explaining myself good.

I'll just put down the code:

FILE-INFO:FILENAME = Nombre_Fichero.
SET-SIZE( m ) = FILE-INFO:FILE-SIZE.
INPUT FROM VALUE (FILE-INFO:FILENAME) BINARY.
IMPORT m.
INPUT CLOSE.
CREATE TCliente.
ASSIGN
TCliente.imagen = m.
TCliente.ID_Cliente = INT (cCliente).

FIND FIRST TCliente.
/*Nombre_Fichero = session:TEMP-DIRECTORY + "\wind.jpg".
COPY-LOB FROM OBJECT TCliente.imagen TO FILE Nombre_Fichero NO-CONVERT.
OS-DELETE VALUE(Nombre_Fichero).*/

SET-SIZE( m ) = 0.

RUN saveLogo.p ON SERVER hParticion(pPais,cCliente,INPUT TABLE TCliente).
Then, saveLogo...

FIND FIRST Clientes.Datos_Cliente USE-INDEX ID_Cliente WHERE Datos_Cliente.ID_Cliente = int(cCliente) EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE Datos_Cliente THEN DO:
COPY-LOB TCliente.imagen TO m.
COPY-LOB m TO Datos_Cliente.Logo.
END.


As I work against a server machine I must copy it first to a temp-table, call a remote procedure on the server side and copy it again, but now to the real DB :)

Cliente in spanish is Employee :) (sorry for not translating the code)
 
eMe,

Thank you for the code example. I fully understand the issues of leaving the files on the file systems. It will be great to have them in the database.

Coming up on the To-Do-List is a document control module. At that point we will experiment with the option of saving all our business docs to the database also.

:)Have a great weekend!

Mike
 
Back
Top