To access Iocaml require the package iocaml-kernel.notebook
yes, either Iocaml.dispaly or Iocaml.send_mime could do the job in sligthly different ways:
?context:Iocaml.cell_context -> ?base64:bool -> string -> string -> unit
The last two options are "mime_type" and "data as a string". You also need the base64 option here so we would do:
Iocaml.display ~base64:true "image/png" png_data_loaded_from_file
So you need to load the png data as a string from the file. Various ways to do this in http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html, but heres some untested code;
let load_file_as_string file =
let b = Buffer.create 1024 in
let rec f () =
try Buffer.add_char (Char.chr (input_byte file)); f()
with End_of_file -> Buffer.contents b
in
f()
Using the mime stuff can be done with a function like copy_stream : in_channel -> out_channel -> unit
ie
let rec copy_stream in_chan out_chan =
try
output_byte out_chan (input_byte in_chan));
copy_stream in_chan out_chan
with _ -> ()
Then
copy_stream in_file Iocaml.mime;
Iocaml.send_mime ~base64:true "image/png"