Highlighted
Absent Member.
Absent Member.
2176 views

[archive] Photo Image Databas

[Migrated content. Thread originally posted on 05 August 2003]

We are developing an HR program in cobol, is it possible
to take a photo through cobol and store it in a binary vision
file

We have a web cam attached and can probably find an ocx to
take the photo as a jpg but how to convert the jpg into a
vision data record
0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Photo Image Databas

With the 6.0 runtime and vision 5 you can store 64MB in a record. This should be large enough to hold most image files.

If you need to display the images stored in a vision file from your acucobol program with W$BITMAP then you'll run into a problem because you can only load an image from a physical image file and not from a record in a vison file, nor from working storage. Hopefully, this will be corrected in the next release of 6.x.
Can anyone from acucorp confirm this?

So, if you plan to move ahead even without the W$BITMAP support, you would basically open the image file as a binary sequential file, read and move it's record area to a vison file record area and then write the vision record. As a workaround to the W$BITMAP problem, as needed, you could write a temporary binary sequential file from the vision record and then use W$BITMAP to load the temporary image file, but that may or may not be efficient for your application.

Also, which most people do now, is just store the path of the image file in your vision record and then use that path with W$BITMAP to load the physical image file for display. Be sure the integrity of the image file stays in tact, since it is seperate from your vision data and can be moved or deleted by the user external of your acucobol appliction.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Photo Image Databas

Hello Dan,

I am just getting started with Acubench. I've managed to create a fairly simple maintenance program. The program is a "member maintenance" sort of app. I need to be able to display the members photo on the screen but am having trouble. Do you have any samples of the "Stored Path" method you mentioned in your post using the bench?

Any help would be greatly appreciated!

Mick Force
Handicomp
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Photo Image Databas

Mforce, I don't have a small example, but the snippets of code you need can be easily found by searching through the Acucobol samples that were installed when you ran the setup from the Acucorp CD. Look for them in C:\Acucorp\Acucbl610\AcuGT\sample\samplprj\source. The journey of building your own program is very educational, so dig in. Here are the steps you can follow to develop your own code:

1. If the user will select the image file, then use the library routine C$OPENSAVEBOX to prompt for a file selection. The path to the file will be returned. (To see an example use the acubench File Find feature to Search the acucorp sample programs for the string C$OPENSAVEBOX).

2. With the returned file path from C$OPENSAVEBOX, you can do a number of things. For instance, display the image on screen with the BITMAP control. To do this, call the W$BITMAP library routine first, passing it the file path. A BITMAP-HANDLE will be returned which you then use as the BITMAP-HANDLE property for the BITMAP-CONTROL. (To see an example use the acubench File Find feature to Search the Acucobol samples for the strings W$BITMAP and BITMAP).

3. Also, you can now save the returned path in a vision file. Just make the PIC X field large enough to hold long paths. Nothing smaller than 100 bytes I would say(so PIC X(100) at least, but even a little larger would be a good idea).

4. When you want to display the image from a stored path, just read your vision file and use the path field the same way you used the return file path in Step 2 to create a BITMAP-HANDLE with W$BITMAP and then display the bitmap using the BITMAP-HANDLE with the BITMAP control.

So here's a summary:
- Get the path to the image file. (C$OPENSAVEBOX)
- Create a bitmap handle for the image file. (W$BITMAP)
- Display the image file using the bitmap handle. (BITMAP control)
- Store the image file path. (WRITE a vision record)
- Retrieve the stored image file path. (READ a vision file)


Enjoy the journey!
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Photo Image Databas

I'll give it a whirl and let you know how it goes.

I really appreciate the help!

Mick
http://www.handinet.com
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Photo Image Databas

I just want to state that w$bitmap not being able to display pictures directly from a vision record hardly can be stated as a bug.
I do agree however that it is a good idea.
However, as far as I know, this has not been proposed, so I would urge you to request this as an enhancement if you think "popping" the binary into a separate file would be too much of a "burden" 🙂
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Photo Image Databas

A "burden"? That's funny, I like that. Gee, I guess we lazy acucobol programmers just want it all. 🙂

Actually, this issue was pointed out at least years development conference, but perhaps the person who asked the question did not submit an enhancement request. I'll submit it , but I hope it's not too much of a "burden" for acucorp development to program it. 😉 Just kidding folks. 😄
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.