title: Convert a JPG (png / GIf, etc) as a 64base String:
body: <p>I'm using Delphi 7 and Indy 9 on XP SP3. </p>
  
  <p>I have HTML with multiple <code>&lt;img&gt;</code> tags in it.  </p>
  
  <p>I want to convert <code>&lt;img src="filepath" ...&gt;</code> tags into <code>&lt;img src="data:image/jpg;base64,..."&gt;</code> tags. </p>
  
  <p>As an exercise, I planned to do it on each image like this:</p>
  
  <pre><code>procedure TForm1.Button2Click(Sender: TObject);
  VAR
     Str    : AnsiString;
     Stream1, Stream2  : TFileStream;
     Decoder : TIDEncoderMime;
  
  BEGIN
     Stream1 := TFilestream.Create(Curdir + '\solopgang.jpg', fmOpenRead);
     Stream2 := TFilestream.Create('C:\test221.html', fmCreate);
     Try
        Decoder := TIDEncoderMime.Create(NIl);
        Str := decoder.Encode(Stream1^, length(Stream1));
        StrToFile('c:\test221.html',Str);
     Finally
        FreeAndNil(Decoder);
        Stream1.Free;
        Stream2.Free;
    END;
  end;
  </code></pre>
  
  <p>But, when I show it in my <code>TWebBrowser</code>, I get only the outer frame of the Image, and I don't know why.</p>