# This file is part of django-sponsors, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of django-sponsors, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.loader import render_to_string
from PIL import Image
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.loader import render_to_string
from PIL import Image
THUMB_WIDTH = getattr(settings, 'SPONSORS_THUMB_WIDTH', 120)
THUMB_HEIGHT = getattr(settings, 'SPONSORS_THUMB_HEIGHT', 120)
THUMB_WIDTH = getattr(settings, 'SPONSORS_THUMB_WIDTH', 120)
THUMB_HEIGHT = getattr(settings, 'SPONSORS_THUMB_HEIGHT', 120)
sprite = Image.new('RGBA', (total_width, total_height))
offset = 0
for i, sponsor_id in enumerate(sponsor_ids):
sprite = Image.new('RGBA', (total_width, total_height))
offset = 0
for i, sponsor_id in enumerate(sponsor_ids):
- (thumb_size[0] - simg.size[0]) / 2,
- offset + (thumb_size[1] - simg.size[1]) / 2,
+ int((thumb_size[0] - simg.size[0]) / 2),
+ int(offset + (thumb_size[1] - simg.size[1]) / 2),