Home > database >  Graphic images in the database
Graphic images in the database

Time:10-03

I am doing a paper management system, the user requirements in the input box, can from the open file copying pictures first, and then paste to enter the corresponding position of the interface, the image can be saved to the data in the table,
Can you tell me whether this should be how to implement, to use the API to achieve? Thank you very much!

CodePudding user response:

This can add a picture in the data window controls, using selectblob read the database columns, UpdateBlob to update the

CodePudding user response:

Have a look at the function, said very understand
//====================================================================
//function initialized to photos, change the picture
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
///entrance parameters ai_flag 0 initialization photo
//1 photos to a temporary file, when retrieving with
//2 change picture
//3 save picture
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
///the return value 0 success
Failure//- 1
//
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//use special terms temporary files in the current directory and named f # & amp; @ BMP. @ @ @
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
///maintenance history Kalen xiao 2001-1-7

//====================================================================
Integer li_filehandle, I, li_multiple RTN,
Long ll_filelength
Boolean lb_autocommit
String ls_pfilename, ls_named
Blob lbb_photoread, lbb_photo

Choose a Case ai_flag
Case 0
If FileExists (gs_sysrunpath + "/BMP/f # & amp; @ BMP. @ @ @ ") Then
If Not FileDelete (gs_sysrunpath + "/BMP/f # & amp; @ BMP. @ @ @ ") Then Return 1
End the If
Tab_1. Tabpage_1. Dw_2. Object. P_photo. Filename=gs_sysrunpath + "/BMP/f # & amp; @ BMP. @ @ @
"Return 1
Case 1
SelectBlob fphoto Into: lbb_photo From t_hrempl
Where fentityno=: gs_entityno
And fempno=: is_empno
Using the sqlca.
If the sqlca. SQLNRows & lt;> 1 Then
The Return - 1
End the If
If IsNull (lbb_photo) Then Return 1
If the Mod (Len (lbb_photo), 32765) & lt;> 0 Then
Li_multiple=Round (Len (lbb_photo)/32765, 0) + 1
The Else
Li_multiple=Len (lbb_photo)/32765
End the If

Li_filehandle=FileOpen (gs_sysrunpath + "/BMP/f # & amp; @ BMP. @ @ @ "streammode! The Write! , lockwrite! The Replace!
If li_filehandle=1 Then
The Return - 1
End the If
//deposited in the temporary file
For I=1 To li_multiple
Lbb_photoread=BlobMid (lbb_photo, (I - 1) * 32765 + 1, 32765)
If FileWrite (li_filehandle lbb_photoread)=1 Then
The Return - 1
End the If
Next
FileClose (li_filehandle)
If tab_1. Tabpage_1. Dw_2. Object. P_photo. Filename & lt;> Gs_sysrunpath + "/BMP/f # & amp; @ BMP. @ @ @ "Then
Tab_1. Tabpage_1. Dw_2. Object. P_photo. Filename=gs_sysrunpath + "/BMP/f # & amp; @ BMP. @ @ @
"End the If
Return 0

Case 2
RTN=GetFileOpenName (" Select File ", ls_pfilename, ls_named, BMP ""," BMP Files (*. BMP), *. BMP ")
If RTN=1 Or RTN=0 Then
The Return - 1
The Else
Tab_1. Tabpage_1. Dw_2. Object. P_photo. Filename=ls_pfilename
Cb_sav. Enabled=True
Return 1
End the If
Case 3
Ls_pfilename='
Lbb_photo=Blob (')
Ls_pfilename=tab_1. Tabpage_1. Dw_2. Object. P_photo. Filename
If ls_pfilename=gs_sysrunpath + "/BMP/f # & amp; @ BMP. @ @ @ "Then Return 1
//need update
Ll_filelength=FileLength (ls_pfilename)
Li_filehandle=FileOpen (ls_pfilename streammode! , Read! , lockwrite! The Replace!
If li_filehandle=1 Then
The Return - 1
End the If
If ls_pfilename="' Then
Return 0
End the If
Li_multiple=Round (ll_filelength/32765, 0) + 1
For I=1 To li_multiple
If FileRead (li_filehandle lbb_photoread)=1 Then Return 1
Lbb_photo=lbb_photo + lbb_photoread
Next
FileClose (li_filehandle)
If IsNull (lbb_photo) Then
The Return - 1
End the If
Lb_autocommit=sqlca. The AutoCommit
The sqlca. The AutoCommit=True;
UpdateBlob t_hrempl set fphoto=: lbb_photo where fentityno=: istr_dot. Fstr3 And & amp;
Fempno=: istr_dot. Fstr4;
If the sqlca. SQLCode=0 Then
COMMIT the Using the sqlca;
The sqlca. The AutoCommit=lb_autocommit;
Return 1
The Else
The ROLLBACK Using sqlca;
The sqlca. The AutoCommit=lb_autocommit;
The Return - 1
End the If
The End Choose
Return 0

CodePudding user response:

Thank you, I want to effect is from autocad or other drawing software to copy a piece of paste to the input interface in saved to the database after
Upgrade system of Delphi written before, I use the TDBimage in PB excuse me?
Please help!!!!!
  • Related