Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to import image during append record in my program

Status
Not open for further replies.

jajiyiko

Programmer
Mar 18, 2002
33
TR
Hi friends
I write a program with visual dbase 7.5
this program good works but when i want to add record i can not add a image.
how to import image during append record in my program?
now thanks
 
Below is VDB 5.7 approach I used to add pictures to a form.
You may be able to transate it into 7.5 since it is an upgrade from 5.7. I hope it helps.

******************** VDB 5.7 APPROACH ********************
1. On .DBF add field name "Client" Define as Character
2. On .DBF add field name "BMP" Define as Binary
3. In form .WFM have a defined field: NOTE DATASOURCE

4. In the same program, when you retrieve the Client's record it will display in the defined IMAGE field above.

5. Instructions to find client. You will not need all of the coding to locate a client, this is what I used setting up a client record and insure no duplication.
PROCEDURE FIND_CLIENT
PUBLIC KEY1,KEY2,KEY3
SELECT 1 && Client's .DBF file
PUBLIC REC
REC = 1
KEY1 = TRIM(form.SEARCH_DATA.Value) && Client ID
KEY2 = LOWER(KEY1) && Making sure of upper/lower case
KEY3 = SUBSTR(KEY1,1,1)+SUBSTR(KEY2,2,10) && combine
IF .NOT. EMPTY(KEY3)
PRIVATE lExact
lExact = SET("Exact")
SET EXACT OFF
SEEK(TRIM(KEY3))
SET EXACT &lExact
IF FOUND()
Apnd = .F.
Rec = RECNO()
&&******************* Already On File *********************
form.MAKE_PAGE_2_VISIBLE()
form.HOLD_ID_P2.Value = form.CLIENT_ID.Value && For Page 2 control
&&*********************************************************
form.REVIEW_HISTORY()
ELSE
form.HOLD_ID_P2.Value = "AAAA9999" && Indicates new client addition
Apnd = .T.
APPEND BLANK
form.FIRST_NAME.SetFocus()
ENDIF
ENDIF


6. Adding picture to the above Client file. Picture from camera or file stored on a floppy disc. The ID MUST be the same as the Client's ID in order to locate the proper record to store the picture. Below is the .WFM I used to store the picture. Since this is 5.5 it may not solve all your problems , but it may be food for thought. Lots of luck. The Gipper

&&PUBLIC ERROR_SW
&&ERROR_SW = "NO "
** END HEADER -- do not remove this line*
* Generated on 03/18/2002
*
parameter bModal
local f
f = new BMP_FORM()
if (bModal)
f.mdi = .F. && ensure not MDI
f.ReadModal()
else
f.Open()
endif
CLASS BMP_FORM OF FORM
Set Procedure To \XYZ\BUTTONS.CC additive
this.OnOpen = CLASS::COPY_FILES
this.Text= "Put Client Picture on Record"
this.Top = 2.7646
this.WindowState = 2
this.MDI = .F.
this.ShowSpeedTip = .F.
this.View = "BMP_NAME.QBE"
this.Left = 16.833
this.Height = 27.1172
this.Width = 80.666

PROCEDURE COPY_FILES
**********************
PUBLIC ID, ObjArr
ObjArr=NEW ARRAY() && Building an array based on the Directory of Drive A.
ObjArr.Dir("\BAILBOND\*.BMP","A") && Filling the Array ObjArr.
SELECT 2
USE BMP_NAME AGAIN EXCLUSIVE
IF RECCOUNT() > 0 && BMP_NAME is a work file, cleared at begining of 1st time thru
SET SAFETY OFF && If an BMP name error was found, this is bypassed after
ZAP && corrections are made. No need to rebuild table file.
SET SAFETY ON && The SAFETY ON/OFF makes intervention un-necessary.
ENDIF
SET EXCLUSIVE OFF
FOR i = 1 TO ObjArr.Size/5
ID = ObjArr[i,1]
SELECT 2
APPEND BLANK
REPLACE BMP_NAME->BMP_NAME WITH UPPER(LEFT(ID,1))+LOWER(SUBSTR(ID,2,11))
ID = SUBSTR(BMP_NAME->BMP_NAME,1,8) + ".bmp"
REPLACE BINARY BMP FROM BMP_NAME->BMP_NAME
NEXT i
form.CLOSE()
DO ERRORCHK.WFM

PROCEDURE FORM_ON_CLOSE
form.CLOSE()
DO MASTER.WFM

ENDCLASS





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top