рендерить на картинке с грамотой имя ученика перед отправкой

remotes/origin/feature/signed-user-cert-20-03-19
gzbender 7 years ago
parent ceffa402a2
commit 05bb6838ec
  1. 6
      apps/notification/tasks.py
  2. BIN
      web/src/fonts/ProximaNova-Reg.otf
  3. BIN
      web/src/img/user-certificates/1.jpg
  4. BIN
      web/src/img/user-certificates/2.jpg
  5. BIN
      web/src/img/user-certificates/3.jpg
  6. BIN
      web/src/img/user-certificates/4.jpg
  7. BIN
      web/src/img/user-certificates/5.jpg
  8. BIN
      web/src/img/user-certificates/6.jpg
  9. BIN
      web/src/img/user-certificates/7.jpg
  10. BIN
      web/src/img/user-certificates/8.jpg
  11. BIN
      web/src/img/user-certificates/9.jpg

@ -24,12 +24,12 @@ User = get_user_model()
def draw_cert(path, email, first_name, last_name):
img = Image.open(path)
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("/app/Microsoft Sans Serif.ttf", 92)
text = "награждается " + first_name
font = ImageFont.truetype(os.path.join(settings.STATIC_ROOT, 'ProximaNova-Reg.otf'), 170)
text = first_name
if last_name:
text += ' ' + last_name
w, h = draw.textsize(text, font=font)
draw.text(((img.width - w) // 2, 750), text, (29, 115, 224), font=font)
draw.text(((img.width - w) // 2, 900), text, (29, 115, 224), font=font)
fn = os.path.join(settings.MEDIA_ROOT, 'tmp')
try:
os.mkdir(fn)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 941 KiB

Loading…
Cancel
Save