unmatched faces now sorts size of face desc, and is slightly prettier -- still slow and only takes you to the file anyway, might optimise that later. still no code to auto deal with unmatched face, but will add some capabilities next. Also, remembered last dir when file_ip/sp/bin. Also throw error if try to find unknown person - happened since I allowed the back/forward.

This commit is contained in:
2022-01-18 20:59:39 +11:00
parent 4c3aae770d
commit de81db9412
11 changed files with 80 additions and 73 deletions

View File

@@ -163,6 +163,10 @@
{% if not InDBox %}
<script>
// do our own back button handling, TODO: 'dangerous' URLs, will be replaced with GETs first via history.replaceState()
window.onpopstate = function(e) {
window.history.back()
}
function SetViewingOptionsForSearchForm()
{
if( $('#noo').length )

View File

@@ -6,42 +6,34 @@
<h3>Unmatched Faces</h3>
<div class="row mt-3">
{% for f in faces %}
<div id="F{{f.id}}" class="col-2 px-0">
<div id="F{{f.id}}" class="col col-auto mt-3 pr-1">
<form id="_fm" method="POST" action="/view/{{f.file_eid}}">
<input type="hidden" name="eids" value="{{f.file_eid}},">
<input type="hidden" name="noo" value="newest">
<input type="hidden" name="cwd" value="/">
<input type="hidden" name="root" value="/">
<input type="hidden" name="size" value="128">
<input type="hidden" name="grouping" value="1">
<input type="hidden" name="offset" value="0">
<input type="hidden" name="folders" value="false">
<input type="hidden" name="how_many" value="1">
<input type="hidden" name="orig_url" value="{{request.path}}">'
<input type="hidden" name="eids" value="{{f.file_eid}},">
<figure id="fig_{{f.id}}" class="mb-0">
<div style="position:relative">
<canvas id="c_{{f.id}}" height="128"></canvas>
<script>
var im_{{f.id}}=new Image();
im_{{f.id}}.src="data:image/jpeg;base64,{{f.img}}";
fig_{{f.id}}=$('#fig_{{f.id}}')
// store this stuff in an javascript Object to use when document is ready event is triggered
var orig_face_{{f.id}}=new Object;
orig_face_{{f.id}}.x = (({{f.locn[0][1]}}*1.05 - {{f.locn[0][3]}}*.95) - {{f.w}}) / 2
orig_face_{{f.id}}.y = (({{f.locn[0][2]}}*1.05 - {{f.locn[0][0]}}*.95) - {{f.h}}) / 2
orig_face_{{f.id}}.w = {{f.w}}
orig_face_{{f.id}}.h = {{f.h}}
orig_face_{{f.id}}.orig_w = {{f.locn[0][1]}}*1.05 - {{f.locn[0][3]}}*.95
orig_face_{{f.id}}.orig_h = {{f.locn[0][2]}}*1.05 - {{f.locn[0][0]}}*.95
<figure id="fig_{{f.id}}">
<div style="position:relative">
<canvas id="c_{{f.id}}" height="128"></canvas>
<script>
var im_{{f.id}}=new Image();
im_{{f.id}}.src="data:image/jpeg;base64,{{f.img}}";
fig_{{f.id}}=$('#fig_{{f.id}}')
// store this stuff in an javascript Object to use when document is ready event is triggered
var orig_face_{{f.id}}=new Object;
orig_face_{{f.id}}.x = {{f.locn[0][3]}}
orig_face_{{f.id}}.y = {{f.locn[0][0]}}
orig_face_{{f.id}}.w = {{f.locn[0][1]}}-{{f.locn[0][3]}}
orig_face_{{f.id}}.h = {{f.locn[0][2]}}-{{f.locn[0][0]}}
orig_face_{{f.id}}.orig_w = orig_face_{{f.id}}.w
orig_face_{{f.id}}.orig_h = orig_face_{{f.id}}.h
console.log( orig_face_{{f.id}} )
// when the document is ready, then DrawRefimg
$(function() { DrawRefimg( fig_{{f.id}}, im_{{f.id}}, c_{{f.id}}, orig_face_{{f.id}} ) });
</script>
<figcaption>{{f.id}}</figcation>
</div>
</figure>
<button>Go</button>
// when the document is ready, then DrawRefimg
$(function() { DrawRefimg( fig_{{f.id}}, im_{{f.id}}, c_{{f.id}}, orig_face_{{f.id}} ) });
</script>
<figcaption>Face #{{f.id}}</figcation>
</div>
</figure>
<button class="btn btn-outline-info">Go</button>
</form>
</div id="/F*">
{% endfor %}

View File

@@ -5,7 +5,7 @@
<table id="prefs_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
<thead>
<tr class="table-primary"><th>Path</th><th>New or Oldest</th><th>How Many</th><th>Folders?</th><th>Group by</th><th>Thumb size</th><th>Fullscreen</th><th>DB retrieve offset</th></tr>
<tr class="table-primary"><th>Path</th><th>New or Oldest</th><th>How Many</th><th>Folders?</th><th>Group by</th><th>Thumb size</th><th>Fullscreen</th><th>DB retrieve offset</th><th>Root</th><th>cwd</th></tr>
</thead>
<tbody>
{% for pref in prefs %}
@@ -18,6 +18,8 @@
<td>{{pref.size}}</td>
<td>{{pref.fullscreen}}</td>
<td>{{pref.st_offset}}</td>
<td>{{pref.root}}</td>
<td>{{pref.cwd}}</td>
</tr>
{% endfor %}
</tbody>