Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving Picture type from database
Message
From
26/05/2002 04:14:35
 
 
To
26/05/2002 03:30:59
Yossi Moses
I.S.R Corporation
Jerusalem, Israel
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
00661429
Message ID:
00661431
Views:
30
>I want to pass the content of memo (that is actualy a picture file) to a temporary file, how can I know the type (bmp, jpg, ...).

This will do for most common graphics formats:
FUNCTION ImageTypeAutoDetect
LPARAMETERS m.ImageFile

DO CASE
CASE LEFT(m.ImageFile,2) == "BM"
  m.lcType = "bmp"
CASE INLIST(LEFT(m.ImageFile,6),"GIF87a","GIF89a")
  m.lcType = "gif"
CASE LEFT(m.ImageFile,2) == CHR(0xFF) + CHR(0xD8)
  m.lcType = "jpg"
CASE INLIST(LEFT(m.ImageFile,3),"II*","MM*")
  m.lcType = "tif"
CASE LEFT(m.ImageFile,8) == CHR(137) + "PNG" + CHR(13) + CHR(10) + CHR(26) + CHR(10)
  m.lcType = "png"
OTHERWISE
  m.lcType = ""
ENDCASE

RETURN m.lcType
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform