General information
Category:
Coding, syntax & commands
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only