Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieving Picture type from database
Message
De
26/05/2002 04:14:35
Antonio Lopes (En ligne)
BookMARC
Coimbra, Portugal
 
 
À
26/05/2002 03:30:59
Yossi Moses
I.S.R Corporation
Jerusalem, Israél
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Divers
Thread ID:
00661429
Message ID:
00661431
Vues:
29
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform