new photos directories
This commit is contained in:
parent
cdf660287d
commit
f99a079b71
@ -192,17 +192,18 @@ def results(request):
|
||||
|
||||
|
||||
def photos(request):
|
||||
files = glob.glob("photos/*.jpg")
|
||||
rtn = []
|
||||
random.shuffle(files)
|
||||
for file in files:
|
||||
img = PIL.Image.open(file)
|
||||
rtn.append({
|
||||
'original': '/' + file.replace(".jpg", ".webp"),
|
||||
'thumbnail': '/' + file.replace('photos/', 'photos/thumbnail/').replace(".jpg", ".webp"),
|
||||
'original_width': img.width,
|
||||
'original_height': img.height,
|
||||
})
|
||||
for (i, name) in ALKATOR_CLASSES:
|
||||
files = glob.glob(f"photos/{i}/*.jpg")
|
||||
rtn = []
|
||||
random.shuffle(files)
|
||||
for file in files:
|
||||
img = PIL.Image.open(file)
|
||||
rtn.append({
|
||||
'original': '/' + file.replace(".jpg", ".webp"),
|
||||
'thumbnail': '/' + file.replace('photos/', 'photos/thumbnail/').replace(".jpg", ".webp"),
|
||||
'original_width': img.width,
|
||||
'original_height': img.height,
|
||||
})
|
||||
return HttpResponse(json.dumps(rtn), content_type='application/json')
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user