mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 07:19:15 +02:00
Increase image quality of downscaled images from 70 to 95
This commit is contained in:
parent
5d2e72e69e
commit
609dd3b495
7 changed files with 89 additions and 3 deletions
|
@ -23,6 +23,18 @@ from django.utils import timezone
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def batch(iterable, n=1):
|
||||
has_entries = True
|
||||
while has_entries:
|
||||
current = []
|
||||
for i in range(0, n):
|
||||
try:
|
||||
current.append(next(iterable))
|
||||
except StopIteration:
|
||||
has_entries = False
|
||||
yield current
|
||||
|
||||
|
||||
def rename_file(instance, field_name, new_name, allow_missing_file=False):
|
||||
field = getattr(instance, field_name)
|
||||
current_name, extension = os.path.splitext(field.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue