flask site buildout #2
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user