From e94420e805c7a6c32a71306a26a6a2b7e55a190b Mon Sep 17 00:00:00 2001
From: Christoph Berg <myon@debian.org>
Date: Fri, 16 Oct 2026 15:22:20 +0200
Subject: [PATCH v14 01/12] Require user-supplied badges to be 150x150

Instead of rescaling on the server side, require the badge image to
already be exactly 150x150. This avoids ugly rescaling effects, and
overly large input images cannot eat memory for the rescaling operation.
---
 ..._alter_contributor_ctype_alter_contributor_email_and_more.py | 2 +-
 pgweb/contributors/models.py                                    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pgweb/contributors/migrations/0005_alter_contributor_ctype_alter_contributor_email_and_more.py b/pgweb/contributors/migrations/0005_alter_contributor_ctype_alter_contributor_email_and_more.py
index 7041f702..1c676489 100644
--- a/pgweb/contributors/migrations/0005_alter_contributor_ctype_alter_contributor_email_and_more.py
+++ b/pgweb/contributors/migrations/0005_alter_contributor_ctype_alter_contributor_email_and_more.py
@@ -82,7 +82,7 @@ class Migration(migrations.Migration):
                     "imagedata",
                     pgweb.util.fields.ImageBinaryField(
                         blank=True,
-                        help_text="Square image, will be auto-scaled to 150x150. JPEG or PNG, up to 1 MB. When left blank, the PostgreSQL logo will be used.",
+                        help_text="Square image, must be 150x150. JPEG or PNG, up to 1 MB. When left blank, the PostgreSQL logo will be used.",
                         max_length=1000000,
                         null=True,
                         verbose_name="Image",
diff --git a/pgweb/contributors/models.py b/pgweb/contributors/models.py
index 507cde65..62d5c3a0 100644
--- a/pgweb/contributors/models.py
+++ b/pgweb/contributors/models.py
@@ -102,7 +102,7 @@ class Badge(TwostateModerateModel):
     slug = models.SlugField(max_length=64, null=False, blank=False, unique=True, help_text='URL-friendly identifier for the badge page. Generated from the title when the badge is created, and kept fixed after that.')
     description = models.TextField(null=True, blank=True, help_text='What did the people do who contributed here?')
     url = models.URLField(max_length=100, null=True, blank=True, verbose_name='Contribution URL', help_text='URL for this contribution, e.g. the conference homepage. (Leave blank when there is no URL.)')
-    imagedata = ImageBinaryField(max_length=1000000, resolution=(150, 150), auto_scale=True, blank=True, null=True, verbose_name="Image", help_text="Square image, will be auto-scaled to 150x150. JPEG or PNG, up to 1 MB. When left blank, the PostgreSQL logo will be used.")
+    imagedata = ImageBinaryField(max_length=1000000, resolution=(150, 150), auto_scale=False, blank=True, null=True, verbose_name="Image", help_text="Square image, must be 150x150. JPEG or PNG, up to 1 MB. When left blank, the PostgreSQL logo will be used.")
     contact = models.CharField(max_length=100, null=True, blank=True, verbose_name='Contact address', help_text='Contact address (email, URL, other) for people who want to be added as badge holder')
     holders = models.ManyToManyField(User, through="Badgeholder", through_fields=("badge", "user"), blank=True)
 
-- 
2.53.0

