Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Extracting pictures from a General Field
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Divers
Thread ID:
00946994
Message ID:
00947550
Vues:
28
Well, it is the problem/inconvenience with general fields, no matter it is GIF or any other file. It is recommended to store the file in the binary MEMO field instead.
Meanwhile try the code below, it may meet your needs.
use (yourtable)
Genfiedname="General field name must be here"
lcOutfilename="Fullpath for output GIF file"

go (to appropriate record)

local oForm
oForm = Createobject('_Form',Genfiedname)
WITH oForm.myOLe1
	.refresh
        .DoVerb()  && it should invoke the Host application.
                        && here I assume, it is MS Photo Editor
ENDWITH

oShell = CreateObject("WScript.Shell")
lcWindowTitle="Microsoft Photo Editor"
lnstart=SECONDS()
DO WHILE SECONDS()-lnstart <60 AND NOT oShell.AppActivate(lcWindowTitle)
	WAIT WINDOW TIMEOUT 1.0 "Loading MS PhotoEditor... Please, wait ..."
ENDDO

IF oShell.AppActivate(lcWindowTitle)
	erase (lcOutfilename)
	oShell.SendKeys("%FA")   && invoke Photo Editor SaveAs dialog
	oShell.SendKeys("+{END}")  && remove the default file name
	oShell.SendKeys(lcfilename)
	
	oShell.SendKeys("{ENTER}")   && click Save
	
	lnstart=SECONDS()
	DO WHILE SECONDS()-lnstart <60 AND NOT FILE(lcfilename)
		WAIT WINDOW TIMEOUT 1.0 "Saving... Please, wait..."
	ENDDO
	oShell.SendKeys("%Fx")      && close MS Photo Editor
endif

oForm.release
oShell=.null.
RETURN
*------------------------
Define Class _Form As Form
	PROCEDURE iNIT
		LPARAMETERS pGenFieldName
		this.addobject('myOLe1',"OleBoundControl")
		this.myole1.ControlSource = ALIAS()+'.'+pGenfieldName
	ENDPROC
Enddefine
*-------------------
>Help me:
>
>I have a table with thwo fields:
>
>id_customer c(10) filled
>Photo       g()   filled
>
>How to extract fisically the photo to disk?
>the image format is GIF.
>
>Thanks for your help!!!
>I attempting to Extract to HTML web page image space.
>
>
>Att
>William
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform