# OpenSeadragon [![Gem Version](https://badge.fury.io/rb/openseadragon.png)](http://badge.fury.io/rb/openseadragon) OpenSeadragon is a javascript library for displaying tiling images. This gem packages those assets and some Rails helpers for using them. http://openseadragon.github.io/ # Usage This gem provides two helpers, `#picture_tag` and `#openseadragon_picture_tag`. In your controller add this line: ```ruby helper Openseadragon::OpenseadragonHelper ``` ## picture_tag The `#picture_tag` helper creates [HTML5 tags](http://www.w3.org/TR/html-picture-element/). In the simple case, a view like: ```ruby picture_tag 'page1.jpg', 'page2.jpg', 'page3.jpg' ``` Creates the HTML like: ```html ``` You can control the attributes on `` and `` elements: ```ruby picture_tag ['page1.jpg' => { id: 'first-picture'}], 'page2.jpg', 'page3.jpg', { class: "picture-image" }, { id: 'my-picture'} ``` ```html ``` ## openseadragon_picture_tag If you have an OpenSeaDragon tilesource, you can use this helper to construct a HTML5 `` that will render as an OpenSeaDragon tile viewer. ```ruby openseadragon_picture_tag 'page1.jpg' ``` ```html ``` This gem includes some javascript that translates that markup to the OSD viewer. As with `#picture_tag`, you can provide additional options. ```ruby openseadragon_picture_tag 'page1.jpg', 'path/to/info.json', ['some-custom-tilesource' => { Image: { xmlns: "...", Url: '...', Format: 'jpg', Overlap: 2}}], { class: 'osd-image'}, { data: { openseadragon: { preserveViewport: true, visibilityRatio: 1}}} ``` ```html ``` The `src` attribute (or the JSON-encoded options given in the `data-openseadragon`) are translated into an OpenSeaDragon `tilesource` configuration.