Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 6 JPG and GIF support
Message
 
 
To
25/07/1998 10:21:22
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00121341
Message ID:
00121404
Views:
19
>Is there a command in VFP6 to capture the height and width of a jpg or gif?

See code below...

>Also, does jpg/gif support mean that jpgs and gifs can be added to forms?

Yes, JPG's and GIFS can be used where BMP's can be used. However, animated gifs - while you can view them - the image is static.


Try this code:

o = createobject("cuspicture")
o.loadpicture
?o.picturewidth
?o.pictureheight


Define Class cusPicture as Custom
Picturefile= Null
PictureWidth = 0
PictureHeight = 0

PROCEDURE loadpicture
lParameters cFile
Local oFile,oConvert
oConvert = CreateObject("cusScaleConvert")
*/ This will reset the Picture Object Reference

If Type("Cfile") # "C" Or !File(cFile)
cFile = GetPict()
Endif
If !Empty(cFile) And File(cFile)
oFile = LoadPicture(cFile)
If Type("oFile") = "O" And ;
!IsNull(oFile)
With This
.PictureFile = oFile
.PictureWidth = oFile.Width/oConvert.nFactorX
.PictureHeight = oFile.Height/oConvert.nFactorY
EndWith
Endif
Endif
Return
ENDPROC
EndDefine

DEFINE CLASS cusscaleconvert AS custom


nfactorx = 0
nfactory = 0
Name = "cusscaleconvert"


PROCEDURE convert
LOCAL lihwnd,lihdc,lipixelsperinchx,lipixelsperinchy
* Define some constants.
#DEFINE cnlog_pixels_x 88
#DEFINE cnlog_pixels_y 90
#DEFINE cntwips_per_inch 1440

DECLARE integer GetActiveWindow in WIN32API
DECLARE integer GetDC in WIN32API integer iHDC
DECLARE integer GetDeviceCaps ;
in WIN32API integer iHDC, integer iIndex

lihwnd = getactivewindow()
lihdc = getdc(lihwnd)

lipixelsperinchx = getdevicecaps(lihdc, cnlog_pixels_x)
lipixelsperinchy = getdevicecaps(lihdc, cnlog_pixels_y)

WITH This
.nfactorx = cntwips_per_inch/lipixelsperinchx
.nfactory = cntwips_per_inch/lipixelsperinchy
ENDWITH

Return
ENDPROC


PROCEDURE Init
This.Convert()
ENDPROC


ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform