Skip to content

Commit

Permalink
revert using with in process_picture
Browse files Browse the repository at this point in the history
  • Loading branch information
vchrisb committed Jun 9, 2022
1 parent 9bdf0b5 commit 66decdb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pictures/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@


def _process_picture(field_file: PictureFieldFile) -> None:
with field_file.open() as file:
with Image.open(file) as img:
for ratio, sources in field_file.aspect_ratios.items():
for file_type, srcset in sources.items():
for width, picture in srcset.items():
picture.save(img)
field_file.open() # the file needs to be open
with Image.open(field_file.file) as img:
for ratio, sources in field_file.aspect_ratios.items():
for file_type, srcset in sources.items():
for width, picture in srcset.items():
picture.save(img)


process_picture = _process_picture
Expand Down

0 comments on commit 66decdb

Please sign in to comment.