Add a message when downloading to make people think more about mentionning LENS and photographer

This commit is contained in:
loulous27 2026-03-05 15:52:44 +01:00
parent 4eed7b6876
commit 50921c82ab
8 changed files with 314 additions and 235 deletions

View file

@ -15,7 +15,7 @@ from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.files.base import ContentFile
from django.core.validators import RegexValidator
from django.core.cache import caches
from django.core.cache import cache, caches
from django.db import models
from django.template.defaultfilters import slugify
from django.urls import reverse
@ -26,6 +26,10 @@ from django.utils.translation import gettext_lazy as _
from PIL import Image, ImageFile, ImageFilter
from django import VERSION
if VERSION[0] >= 5 : # Gestion du cache
caches = cache
logger = logging.getLogger("photologue.models")
@ -367,7 +371,7 @@ class ImageModel(models.Model):
int(x_diff + new_width),
int(y_diff + new_height),
)
im = im.resize((int(x), int(y)), Image.ANTIALIAS).crop(box)
im = im.resize((int(x), int(y))).crop(box)
else:
if not new_width == 0 and not new_height == 0:
ratio = min(
@ -385,7 +389,7 @@ class ImageModel(models.Model):
if new_dimensions[0] > cur_width or new_dimensions[1] > cur_height:
if not photosize.upscale:
return im
im = im.resize(new_dimensions, Image.ANTIALIAS)
im = im.resize(new_dimensions)
return im
def create_size(self, photosize, recreate=False):