In a pinch, you can use Nitrogen to dynamically serve content other than HTML. The image to the right is served as raw data from a Nitrogen module.
Also, this shows how you can use the
function to dynamically set the headers, and in this case, use the
"Content-Disposition" header to make the browser download a file
rather than displaying it in the browser directly. We also demonstrate
wf:download_as/1 function, which is a shortcut to set
the "Content-Disposition" header.
View the source code of demos_contenttype_image.erl to see how it's done.View Module Source