flask site buildout #2

Merged
finn merged 25 commits from mgtut1 into master 2024-08-05 08:41:03 +00:00
3 changed files with 6 additions and 4 deletions
Showing only changes of commit 94434d4f8e - Show all commits

View File

@ -52,8 +52,8 @@ class User(UserMixin, db.Model):
digest = hashlib.md5(self.email.lower().encode('utf-8')).hexdigest()
basedir = os.path.abspath(os.path.dirname(__file__))
pngloc = os.path.join(basedir, 'usercontent', 'identicon', str(digest) + '.png')
icongen = pydenticon.Generator(5, 5, digest=hashlib.md5, foreground=foreground, background=background)
pngicon = icongen.generate(self.email, 120, 120, padding=(10, 10, 10, 10), inverted=False, output_format="png")
icongen = pydenticon.Generator(8, 5, digest=hashlib.md5, foreground=foreground, background=background)
pngicon = icongen.generate(self.email, 150, 240, padding=(10, 10, 10, 10), inverted=False, output_format="png")
if write_png:
pngfile = open(pngloc, "wb")
pngfile.write(pngicon)

View File

@ -1,6 +1,6 @@
<table>
<tr valign="top">
<td><img width="60" height=="60" src="data:image/png;base64,{{ user.gen_avatar(write_png=False) }}"></td>
<td style="vertical-align: middle;"><img style="vertical-align: middle; width: 40px;" src="data:image/png;base64,{{ user.gen_avatar(write_png=False) }}"></td>
<td>{{ post.author.username }} says:<br>{{ post.body }}</td>
</tr>
</table>

View File

@ -3,7 +3,9 @@
{% block content %}
<table>
<tr valign="top">
<td><img src="data:image/png;base64,{{ user.gen_avatar(write_png=False) }}"></td>
<td style="vertical-align: middle; text-align: center;">
<img style="vertical-align: middle;" src="data:image/png;base64,{{ user.gen_avatar(write_png=False) }}">
</td>
<td>
<h1>User: {{ user.username }}</h1>
<h1>CUdebug: {{ current_user }}</h1>