Installing the Surge for the Web Plugin

Surge for the Web is available as a permissively licensed, open-source JavaScript plugin for webmasters to use and distribute on their websites in order to make them capable of displaying SSRG formatted images. To install the plugin on your website, download the official distribution package from the webpage linked prior.

Default Installation

  1. Place the extracted plugin archive contents in wwwroot.

  2. Configure your default page layout file to include the following in the <head> tag:

Custom Installation

Need help with a more specific or custom website setup? We're here to help! Join our Discord server via your Patreon benefits and we'll help you as soon as possible!

Configuring the Server

SSRG format images require special attention in terms of which HTTP headers are used to serve them appropriately to web clients. For any requests for SSRG image resources, always use the following response headers:

Content-Type: application/x-cfs-surge
Content-Encoding: gzip

Note that response compression should be DISABLED for SSRG resource requests; as SSRG format files are already implicitly wrapped in a G-Zip container.

Using Surge for the Web in Content

Place an <img> tag pointing towards a Surge resource anywhere, anytime! It will automatically get replaced with a dynamically rendered HTML5 <canvas> element that decodes and displays the custom content properly. width and height attributes are not respected.

<img class="img-media" src="/images/example.ssrg" />