Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IfPictureFile() custom function
Message
From
23/01/2007 07:33:11
 
 
To
23/01/2007 06:41:57
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
01188001
Message ID:
01188035
Views:
21
>Thanks Gregory and Tore,
>
>Gregory's one is guarantee all picture types. I think so you copied that from your libraries. I made some corrections (TRUE,FALSE,T_CHARACTER)

Yes, Metin. I'm used to including foxpro.h and have TRUE and FALSE defined in my include file

I did not take it from my library. Just thought that stretch = 0, would set the width/height for valid picture files and leave them 0 for unvalid ones
#define TRUE .t.
#define FALSE .f.
#define T_CHARACTER  'C'   && from foxpro.h
>>>Hi All,
>>>I was looking for extension "JPG", "BMP", "GIF" for picture files but VFP supports a lot of picture types now.
>>>
>>>I think so a function should like IfPictureFile() for check a file if it is an image file which VFP can show. How can I do that?
>>
>>Metin
>>
>>Try this. If you use it often, you may want to add an image object to _screen and use that instead of the creating the image object al over
>>
>>
>>function PictureFile(FileName)
>>
>>	local Success
>>	Success = TRUE
>>	
>>	do case
>>	case !m.Success
>>	
>>	case !inlist(vartype(m.FileName), T_CHARACTER)
>>		Success = FALSE
>>	
>>	otherwise
>>		with createobject('image')
>>
>>			.height = 0
>>			.width = 0
>>			.Stretch = 0
>>			.Picture = m.FileName
>>			
>>			Success = !empty(.height) and !empty(.width)
>>		
>>		endwith
>>	
>>	endcase
>>	
>>	return m.Success
>>	
>>endfunc
>>
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform