1

iam trying to load image from resource inside image htmlTag as example

<img src="'+ Resourceimage +'">

i tried to do something like this

function getFullHTML(res:string):string;
var
  sURL : string;
  resorceimg : TResourceStream;
  begin
  resorceimg := TResourceStream.Create(HInstance, res, RT_RCDATA);
    sURL  := 'res://'+ resorceimg +'';
  end;

then i call the function like this

<img src="'+ getFullHTML('imagename') +'">

but i cannot use a TResourceStream into string i think iam doing it in horrible way how exactly i can load image from resource into html image ?

mjn
  • 36,362
  • 28
  • 176
  • 378
MartinLoanel
  • 184
  • 3
  • 17

1 Answers1

3

You can use Data URIs with Base64 encoded images:

Embedding Base64 Images

The image is then embedded like

<img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />

The anwers to the linked question list supported browsers.

Community
  • 1
  • 1
mjn
  • 36,362
  • 28
  • 176
  • 378