mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-10 02:09:02 -06:00
panzer meme
This commit is contained in:
@@ -3,8 +3,10 @@ from app.models import User, Search
|
||||
from app.forms import LoginForm, RegistrationForm
|
||||
from app.custom import require_role
|
||||
from werkzeug.urls import url_parse
|
||||
from flask import render_template, redirect, url_for, flash, request, jsonify, abort
|
||||
from flask import render_template, redirect, url_for, flash, request, jsonify, abort, send_file
|
||||
from flask_login import current_user, login_user, logout_user, login_required
|
||||
from io import BytesIO
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import requests
|
||||
import xmltodict
|
||||
import base64
|
||||
@@ -22,6 +24,29 @@ def strgen(length):
|
||||
def unauthorized(e):
|
||||
return redirect(url_for('login'))
|
||||
|
||||
def serve_pil_image(pil_img):
|
||||
img_io = BytesIO()
|
||||
pil_img.save(img_io, 'JPEG', quality=50)
|
||||
img_io.seek(0)
|
||||
return send_file(img_io, mimetype='image/jpeg')
|
||||
|
||||
@app.route('/panzer/')
|
||||
@app.route('/panzer/<string>')
|
||||
def panzer(string='bionicles are cooler than sex'):
|
||||
string = string.replace('+', ' ')
|
||||
image = create_panzer(string)
|
||||
return serve_pil_image(image)
|
||||
|
||||
def create_panzer(string):
|
||||
img = Image.open("./app/static/panzer.jpeg")
|
||||
draw = ImageDraw.Draw(img)
|
||||
font1 = ImageFont.truetype('./app/static/arial.ttf', size=30)
|
||||
font2 = ImageFont.truetype('./app/static/arial.ttf', size=30)
|
||||
draw.text((10, 20), 'Oh panzer of the lake, what is your wisdom?', font=font1)
|
||||
draw.text((250, 500), string, font=font2)
|
||||
return img
|
||||
|
||||
|
||||
@app.route('/profile/')
|
||||
@login_required
|
||||
def profile():
|
||||
|
||||
BIN
app/static/arial.ttf
Normal file
BIN
app/static/arial.ttf
Normal file
Binary file not shown.
BIN
app/static/panzer.jpeg
Normal file
BIN
app/static/panzer.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
@@ -27,21 +27,25 @@
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.tab-left {
|
||||
padding-left: 3rem;
|
||||
}
|
||||
.tab-left {
|
||||
padding-left: 3rem;
|
||||
}
|
||||
</style>
|
||||
{% endblock head %}
|
||||
|
||||
{% block dashboard_body %}
|
||||
<section>
|
||||
<h1 class="title">Profile Settings</h1>
|
||||
<!-- Profile Email Settings Form -->
|
||||
<form class="form-ajax" action="" method="POST" novalidate>
|
||||
{{ form.hidden_tag() }}
|
||||
<div class="field tab-left">
|
||||
<h4 class="title is-4">{{ form.show_email.label }}</h4>
|
||||
{{ form.show_email() }}
|
||||
{{ form.show_email(class="radio") }}
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<!-- Profile Picture Form -->
|
||||
<form class="form-ajax" action="" method="POST" novalidate>
|
||||
{{ form.hidden_tag() }}
|
||||
<h4 class="title is-4">{{ form.profile_picture_file.label }}</h4>
|
||||
{{ form.profile_picture_file(class="") }}
|
||||
@@ -59,7 +63,6 @@
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{ form.submit(class="button is-danger") }}
|
||||
|
||||
Reference in New Issue
Block a user