How to add an image?

Internal image

img ~alt:("Ocsigen Logo")
              ~service:(Eliom_service.static_dir ())

External image

img ~alt:("Ocsigen Logo")
      ~src:(Xml.uri_of_string (""))

The function img has 3 parameters:

For an internal image, the file path is generated using the make_uri function. This function creates the relative URL string using the static directory configured in the configuration file and the given list.

For an external image, you must convert the string url into uri using the uri_of_string function. You can also create an external service.

Download full code


◄ Back to the Quick Howto's