mod letter
This commit is contained in:
parent
104a6e5713
commit
0cbecb557d
|
|
@ -346,10 +346,13 @@ class UsersTable:
|
|||
users = db.query(User).filter(User.id.in_(user_ids)).all()
|
||||
return [user.id for user in users]
|
||||
|
||||
@staticmethod
|
||||
def generate_image_base64(letter, size=200):
|
||||
# Upewniamy się, że size jest krotką
|
||||
if isinstance(size, int):
|
||||
size = (size, size)
|
||||
elif not isinstance(size, (list, tuple)) or len(size) != 2:
|
||||
raise ValueError("Size must be an integer or a tuple of two integers")
|
||||
|
||||
# Tworzenie obrazu z losowym kolorem tła
|
||||
background_color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
|
||||
|
|
@ -363,7 +366,6 @@ class UsersTable:
|
|||
try:
|
||||
font = ImageFont.truetype("arial.ttf", font_size)
|
||||
except IOError:
|
||||
# Jeśli nie ma czcionki Arial, użyj domyślnej
|
||||
font = ImageFont.load_default()
|
||||
|
||||
# Obliczanie pozycji tekstu
|
||||
|
|
|
|||
Loading…
Reference in New Issue