Discussion:
Easy way to scan images
(too old to reply)
Alina Ruso
2008-09-28 20:56:19 UTC
Permalink
My customers would like to scan in some images. This is easily done currently by cutting and pasting into an OLE field. The problem is they're stored in the DBT with a 2 GB limit and I have not had great success with reliability in dbts. Can someone offer a better methodology? I was thinking something like just storing in a data field the name of the image and running it. Would be grateful for some ideas here
thank you
Alina
Ness Stephens
2008-09-29 04:16:25 UTC
Permalink
Hi Alina
I have also found DBT files to be very prone to corruption. I
have overcome this by storing the name including directory in a data field
and using this to restore the images if the dbt file does get corrupted. It
does mean that you have to keep a copy of the image. When the dbt file is
corrupted I remove the binary field from the dbf
eg alter table "members.dbf" drop photo and then add back the
image field
eg alter table "members.dbf" add photo BLOB(0,2)
then I restore the image using the field containing directory and image name
eg replace binary photo from "DirImagename"

Ness
NB it does not solve your 2GB limit
Post by Alina Ruso
My customers would like to scan in some images. This is easily done
currently by cutting and pasting into an OLE field. The problem is they're
stored in the DBT with a 2 GB limit and I have not had great success with
reliability in dbts. Can someone offer a better methodology? I was
thinking something like just storing in a data field the name of the image
and running it. Would be grateful for some ideas here
thank you
Alina
Mervyn Bick
2008-09-29 06:40:58 UTC
Permalink
Post by Alina Ruso
My customers would like to scan in some images. This is easily done
currently by cutting and pasting into an OLE field. The problem is
they're stored in the DBT with a 2 GB limit and I have not had great
success with reliability in dbts. Can someone offer a better
methodology? I was thinking something like just storing in a data field
the name of the image and running it. Would be grateful for some ideas
here
You have answered your own question. <g> Keep all the scanned images in a
subdirectory (or a set of subdirectories that incorporate the date scanned
in the names) and simply store the filename, with its full path, in a
field. No DBT required.

The little example below may give you enough to get going.

Mervyn.


******* Start of example program ********
if not file( "mbphotos.dbf" )
create table mbphotos (photo char(60))
aFiles = new Array()
nFiles = aFiles.dir("c:\duflp\examples\*.*jpg")
use mbphotos
for n = 1 to nFiles
append blank
replace photo with "c:\duflp\examples\"+aFiles[n,1]
endfor
use
endif


** END HEADER -- do not remove this line
//
// Generated on 2008/09/29
//
parameter bModal
local f
f = new _showimageForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class _showimageForm of FORM
with (this)
height = 16.0
left = 52.4286
top = 5.1364
width = 40.0
text = ""
endwith

this.MBPHOTOS1 = new QUERY()
this.MBPHOTOS1.parent = this
with (this.MBPHOTOS1)
left = 8.0
top = 14.5
sql = 'select * from "mbphotos.DBF"'
active = true
endwith

this.IMAGE1 = new IMAGE(this)
with (this.IMAGE1)
height = 8.5
left = 3.0
top = 1.0
width = 33.0
endwith

this.LISTBOX1 = new LISTBOX(this)
with (this.LISTBOX1)
onSelChange = class::LISTBOX1_ONSELCHANGE
height = 4.0
left = 6.0
top = 11.0
width = 29.0
id = 103
dataSource = form.mbphotos1.rowset.fields["photo"]
endwith

this.rowset = this.mbphotos1.rowset

function LISTBOX1_onSelChange
form.image1.dataSource = "FILENAME "+this.value
return

endclass

********** End of Example code *****

Loading...