I'm carrying images per URL and showing TImage . I will work with JPG , GIF and PNG . But I do not know how to find out what kind of extension possess each file, and then differentiate. How do I get header , or any other method for me to know what type of file: GIF or PNG or JPG?
var
  MS : TMemoryStream;
  GIf: TGIFImage;
  jpegimg: TJPEGImage;
begin
  MS := TMemoryStream.Create;
  GIf := TGIFImage.Create;
  jpegimg   := TJPEGImage.Create; ///////
  try
      try
        IdHTTP1.get('http://forum.wmonline.com.br/uploads/av-8929.jpg',MS);
        Ms.Seek(0,soFromBeginning);
        //Gif.LoadFromStream(MS);
        //Logo.Picture.Assign(GIF);
        jpegimg.LoadFromStream(MS);
        Logo.Picture.Assign(jpegimg);
      except
        ShowMessage('ERRO');
        Exit;
      end;
  finally
    FreeAndNil(GIF);
    FreeAndNil(MS);
    jpegimg.Free;  ////
  end;