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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored image and display into a control. 1

Status
Not open for further replies.

shaddow

Programmer
Mar 22, 2001
1,862
0
0
RO
Is there an easy way to save an image into binary field and then to display stored image an image control?
Using VFP 9.0.

PS: it seems that search feature doesnt work.

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Here is a way to do this.
Code:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	ADD OBJECT image1 AS image WITH ;
		Height = 169, ;
		Left = 48, ;
		Top = 24, ;
		Width = 253, ;
		Name = "Image1"
	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 204, ;
		Left = 132, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Show picture", ;
		Name = "Command1"
	PROCEDURE Load
		LOCAL origPic 
		origPic = GETPICT()
		CREATE CURSOR mypictures (pic m)
		GO bottom
		APPEND BLANK
		APPEND MEMO  pic from (origPic)
	ENDPROC
	PROCEDURE command1.Click
		LOCAL tmpPath
		tmpPath = SYS(2023)
		lcFile = tmpPath+'\'+SYS(3)+'.jpg'
		SELECT mypictures
		LOCATE
		STRTOFILE(mypictures.pic,lcFile)
		IF FILE(lcFile)
		  thisform.image1.Picture = lcfile
		ENDIF
	ENDPROC
ENDDEFINE


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Thanks for the fast reply, well i was affraid it would come to that.

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
An easy way to display an image stored in the table is using image.PictureVal and a blob field. The advantage over a binary field is, you don't need to extract the file to disk, the advantage over a general field is, you can still get the picture file out of the blob field. The disadvantage, that this bloats the fpt file still remains.

Bye, Olaf.
 
Well i've used some of those examples and wizards and i saw in the end that bitmap files can easy be binded directly to binary field.

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top