fixed up so DB will work for photos, need to do that in batch mode once per photo though -- for another day

This commit is contained in:
2021-01-10 21:00:26 +11:00
parent c3debb3425
commit e0400ff321
2 changed files with 7 additions and 3 deletions

View File

@@ -71,7 +71,7 @@ class Photos(db.Model):
id = db.Column(db.Integer, db.Sequence('photos_id_seq'), primary_key=True )
name = db.Column(db.String, unique=True, nullable=False )
type = db.Column(db.String, unique=False, nullable=False)
size_MB = db.Column(db.Integer, unique=False, nullable=False)
size_mb = db.Column(db.Integer, unique=False, nullable=False)
# hash might not be unique, this could be the source of dupe problems
hash = db.Column(db.Integer, unique=True, nullable=True)
thumbnail = db.Column(db.LargeBinary, unique=False, nullable=True)
@@ -123,7 +123,11 @@ def photos():
fsize = round(os.stat(file).st_size/(1024*1024))
fname=file.replace(p, "")
view_list.append( Photos( name=fname, type=ftype, size_MB=fsize, hash=fhash, thumbnail=fthumbnail ))
# tmp_photo=Photos( name=fname, type=ftype, size_mb=fsize, hash=fhash )
# db.session.add(tmp_photo)
view_list.append( Photos( name=fname, type=ftype, size_mb=fsize, hash=fhash, thumbnail=fthumbnail ))
# db.session.commit()
return render_template("photos.html", page_title='View Photos', view_path=view_path, file_list=view_list, symlink=symlink, alert=st.GetAlert(), message=st.GetMessage() )

View File

@@ -19,7 +19,7 @@
<a href="{{symlink}}/{{obj.name}}"><img width="128" height="128" src="data:image/jpeg;base64,{{obj.thumbnail}}"></img></a>
{% endif %}
{{obj.name}}
</td></td><td>{{obj.size_MB}}</td><td>{{obj.hash}}</tr>
</td></td><td>{{obj.size_mb}}</td><td>{{obj.hash}}</tr>
{% endfor %}
</tbody></table>
</div class="row">