Commit 443876aa authored by Michael Murtaugh's avatar Michael Murtaugh

mediawall stuff

parent f79d4073
Pipeline #486 failed with stages
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>README</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<style type="text/css">
a.sourceLine { display: inline-block; line-height: 1.25; }
a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
a.sourceLine:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
a.sourceLine { text-indent: -1em; padding-left: 1em; }
}
pre.numberSource a.sourceLine
{ position: relative; left: -4em; }
pre.numberSource a.sourceLine::before
{ content: attr(title);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; pointer-events: all; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
a.sourceLine::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1 id="usage">Usage</h1>
<p>Use python to ensure image tiles and output a JSON index.</p>
<pre><code>python imagetile.py *.JPG &gt; gallery.json</code></pre>
<p>The gallery layer is then initialized with the data…</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode javascript"><code class="sourceCode javascript"><a class="sourceLine" id="cb2-1" title="1"><span class="kw">var</span> data <span class="op">=</span> <span class="va">JSON</span>.<span class="at">parse</span>(<span class="va">request</span>.<span class="at">responseText</span>)<span class="op">;</span></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="va">console</span>.<span class="at">log</span>(<span class="st">&quot;data&quot;</span><span class="op">,</span> data)<span class="op">;</span></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="kw">var</span> vt <span class="op">=</span> <span class="va">leafygal</span>.<span class="at">gridlayout</span>(data[<span class="st">&#39;@graph&#39;</span>])<span class="op">;</span></a>
<a class="sourceLine" id="cb2-4" title="4"><span class="kw">var</span> layer <span class="op">=</span> <span class="va">leafygal</span>.<span class="at">gridlayer</span>(L<span class="op">,</span> vt)<span class="op">;</span></a>
<a class="sourceLine" id="cb2-5" title="5"><span class="va">map</span>.<span class="at">addLayer</span>(layer)<span class="op">;</span></a></code></pre></div>
<p><a title="By James Rosindell (Own work) [CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0)], via Wikimedia Commons" href="https://commons.wikimedia.org/wiki/File%3ALeafy_Seadragon_on_Kangaroo_Island.jpg"><img width="512" alt="Leafy Seadragon on Kangaroo Island" src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Leafy_Seadragon_on_Kangaroo_Island.jpg/512px-Leafy_Seadragon_on_Kangaroo_Island.jpg"/></a></p>
<h1 id="live-examples">Live examples</h1>
<ul>
<li><a href="http://observatory.constantvzw.org/images/gallery.html" class="uri">http://observatory.constantvzw.org/images/gallery.html</a></li>
<li><a href="http://images.constantvzw.org/Techno-Galactic-Software-Observatory/gallery.html" class="uri">http://images.constantvzw.org/Techno-Galactic-Software-Observatory/gallery.html</a></li>
</ul>
<h1 id="documentation">Documentation</h1>
<p>gridlayout takes a list of items.</p>
<p>an item may be a tiled image:</p>
<pre><code>{&quot;id&quot;: &quot;photo/04/foo.jpg&quot;, &quot;name&quot;: &quot;foo&quot;, &quot;tiles&quot;: &quot;photo/04/tiles/foo/z{z}y{y}x{x}.jpg&quot; }</code></pre>
<p>or a named list of items:</p>
<pre><code>{&quot;id&quot;: &quot;photo/04/&quot;, &quot;name&quot;: &quot;04&quot;, &quot;items&quot;: [...] }</code></pre>
<p>Challenge to create a JSON-LD dump of a single folder that can then be combined via json-ld merge and form a (flattened) hierarchy that can then be rendered with the (modified) gridlayout.</p>
<p>Missing piece is to give an identity to the “containing” element which then allows linking (from above).</p>
<p>Imagine:</p>
<pre><code>ld-ls:
{
&#39;@context&#39;: {
baseURI: &quot;http://automatist.org/photo/&quot;
}
&#39;id&#39;: &quot;&quot;,
&#39;items&#39;: [
{
&#39;id&#39;: &quot;photo/2006&quot;,
&#39;type&#39;: &#39;Collection&#39;
},
...
{
&#39;id&#39;: &quot;DVD-Regions_with_key.png&quot;,
&#39;type&#39;: &#39;Image&#39;,
&#39;tiles&#39;: &quot;tiles/DVD-Regions_with_key.png/z{z}y{y}x{x}.jpg&quot;
}
]
}</code></pre>
<p>and:</p>
<pre><code>{
&#39;@context&#39;: {
baseURI: &quot;http://automatist.org/photo/2006/&quot;
}
&#39;id&#39;: &quot;&quot;,
&#39;items&#39;: [
{
&#39;id&#39;: &quot;2006-10-14&quot;,
&#39;type&#39;: &#39;Collection&#39;
},
...
]
}</code></pre>
</body>
</html>
<meta charset="utf-8">
<script src="/node_modules/leaflet/dist/leaflet.js"></script>
<link href="/node_modules/leaflet/dist/leaflet.css" rel="stylesheet" type="text/css">
<style>
div.leaflet-tile {
color: white;
position: absolute;
pointer-events: auto; /* this enables links */
}
div.leaflet-tile img {
pointer-events: auto; /* this enables links */
}
div.leaflet-tile a {
position: absolute;
left: 0; top: 0;
z-index: 1;
font-family: monospace;
font-size: 14px;
line-height: 16px;
text-shadow: 1px 1px 2px black;
margin: 0;
text-decoration: none;
color: white;
}
div.leaflet-tile.summary {
box-sizing: border-box;
border: 1px solid gray;
}
</style>
<div id="map" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; background: black"></div>
<script src="dist/dynatiler.js"></script>
<script>
console.log("dynatiler", dynatiler);
var map = L.map('map', {
maxZoom: 15,
minZoom: 0,
zoom: 0,
crs: L.CRS.Simple,
center: new L.LatLng(0,0),
});
var request = new XMLHttpRequest();
request.open('GET', 'mediawall.json', true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
// Success!
var data = JSON.parse(request.responseText);
var pelts = [];
var x = 0,
y = 0,
items = data['items'];
console.log("items", items);
var cols = Math.ceil(Math.sqrt(items.length));
console.log("cols", cols);
for (var i=0, l=items.length; i<l; i++) {
pelts.push({x: x, y: y, item: items[i].thumb});
if (++x >= cols) { x = 0; y += 1; }
// if (i == 300) break;
}
console.log("pelts", pelts);
var layout = dynatiler.lazytiler();
var tiler = layout(pelts);
var layer = dynatiler.gridlayer(L, tiler);
map.addLayer(layer);
} else {
console.log("server ERROR");
}
};
request.onerror = function() {
console.log("connection ERROR");
};
request.send();
</script>
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment