changed dimension getting (hopefully faster now)

This commit is contained in:
2024-07-08 12:06:54 +02:00
committed by Flo Greistorfer
parent efbdcea997
commit 8ab95e252f

View File

@@ -169,14 +169,15 @@ def list_folder(folder: str, title: str) -> None:
contains_files = True contains_files = True
if extsplit[1].lower() in args.file_extensions: if extsplit[1].lower() in args.file_extensions:
with Image.open(os.path.join(folder, item)) as img: with Image.open(os.path.join(folder, item)) as img:
width, height = img.size
img.close()
image = { image = {
"url": f"{args.web_root_url}{baseurl}{urllib.parse.quote(item)}", "url": f"{args.web_root_url}{baseurl}{urllib.parse.quote(item)}",
"thumbnail": f"{args.web_root_url}.thumbnails/{baseurl}{urllib.parse.quote(extsplit[0])}.jpg", "thumbnail": f"{args.web_root_url}.thumbnails/{baseurl}{urllib.parse.quote(extsplit[0])}.jpg",
"name": item, "name": item,
"width": img.width, "width": width,
"height": img.height, "height": height,
} }
img.close()
if not os.path.exists(os.path.join(args.root_directory, ".thumbnails", foldername, item)): if not os.path.exists(os.path.join(args.root_directory, ".thumbnails", foldername, item)):
thumbnails.append((folder, item)) thumbnails.append((folder, item))
for raw in RAW_EXTENSIONS: for raw in RAW_EXTENSIONS: