Support path options for image_tag and other tag_helpers

In our application we use a background worker to generate html that then is processed by chromium to print as pdf.

Previously we used wkhtmltopdf, but were annoyed with multiple shortcomings regarding performance, available js, html and css features and consistency of the output files between environments. In wkhtmltopdf every asset needed to be directly included in the html through base64 encoding or insertion. This caused “huge” html files. When switching to printing through the browser we tried including assets using the file protocol and an explicitely stated host to generate absolute paths on the system. This worked excellently for stylesheets and javascript. But we discovered problems when trying to include images this way.

When looking at the code for the the tag helpers, all use the #path_to_asset to generate the url containing the proper digest etc. But the options passed to the method differ depending on the helper. Stylesheet and javscript honour the protocol and host options, whereas for images only skip_pipeline is used.

This required us to implement custom logic for #image_tag and #resolve_image_source.

We would like to extend/homogenize all tag and link helper methods to consistently support the path options host and protocol.