1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-25 08:50:45 +02:00

Add permalink to setup for comparing images with webroot/compare/compare.php, fix #92.

This commit is contained in:
Mikael Roos
2015-05-08 09:38:12 +02:00
parent 2651c9ea02
commit 7a0626d9bf
3 changed files with 60 additions and 36 deletions

View File

@@ -43,13 +43,15 @@ input[type=text] {
<h1>Compare images</h1>
<p>Add link to images and visually compare them. Change the link och press return to load the image. <a href="http://dbwebb.se/opensource/cimage">Read more...</a></p>
<p><a id="permalink" href="?">Direct link to this setup.</a></p>
<form>
<p>
<label>Image 1: <input type="text" id="input1" data-id="1"></label> <img id="thumb1"></br>
<label>Image 2: <input type="text" id="input2" data-id="2"></label> <img id="thumb2"></br>
<label>Image 3: <input type="text" id="input3" data-id="3"></label> <img id="thumb3"></br>
<label>Image 4: <input type="text" id="input4" data-id="4"></label> <img id="thumb4"></br>
<label><input type="checkbox" id="viewDetails">Hide image details?</label><br/>
<label><input type="checkbox" id="viewDetails">Show image details</label><br/>
<label><input type="checkbox" id="stack">Stack images?</label>
</p>
</form>
@@ -66,25 +68,25 @@ input[type=text] {
<div id="area1" class="area">
<code>Image 1</code><br>
<img id="img1">
<pre id="json1" class="json"></pre>
<pre id="json1" class="json hidden"></pre>
</div>
<div id="area2" class="area">
<code>Image 2</code><br>
<img id="img2">
<pre id="json2" class="json"></pre>
<pre id="json2" class="json hidden"></pre>
</div>
<div id="area3" class="area">
<code>Image 3</code><br>
<img id="img3">
<pre id="json3" class="json"></pre>
<pre id="json3" class="json hidden"></pre>
</div>
<div id="area4" class="area">
<code>Image 4</code><br>
<img id="img4">
<pre id="json4" class="json"></pre>
<pre id="json4" class="json hidden"></pre>
</div>
</div>
@@ -96,9 +98,23 @@ input[type=text] {
<script src="../js/cimage.js"></script>
<script>
<?php
if (isset($script)) {
if (isset($_GET['input1'])) {
// Use incoming from querystring as defaults
?>
CImage.compare({
"input1": "<?=$_GET['input1']?>",
"input2": "<?=$_GET['input2']?>",
"input3": "<?=$_GET['input3']?>",
"input4": "<?=$_GET['input4']?>",
"json": <?=$_GET['json']?>,
"stack": <?=$_GET['stack']?>
});
<?php
} else if (isset($script)) {
// Use default setup from js configuration
echo $script;
} else {
// Use defaults
echo "CImage.compare({});";
} ?>
</script>