Author: Tomas Rutkauskas
Can someone tell me how I get to know the TImage graphic type at runtime? When I
know the graphic type, I can choose different ways to save the image.picture to a
blob field.
Answer:
Use RTTI like this:
1 if (Image.Picture.Graphic <> nil) then2 begin3 if (Image.Picture.Graphic is TBitmap) then4 {... it's a bitmap ...}5 elseif (Image.Picture.Graphic is TIcon) then6 {... it's an icon ...}7 elseif (Image.Picture.Graphic is TMetaFile) then8 {... it's a meta file ...}9 elseif (Image.Picture.Graphic is TJPEGImage) then10 {... it's a JPEG ...}11 else{... etc.}12 end;