comparison core/images/upload.py @ 1197:ba23e79438f4

Another attempt to write BytesIO to a file.
author Brian Neal <bgneal@gmail.com>
date Sun, 07 May 2023 19:23:35 -0500
parents e3a7e876aca7
children 3a03c2b2df05
comparison
equal deleted inserted replaced
1196:e3a7e876aca7 1197:ba23e79438f4
161 shutil.copy(filename, image_path) 161 shutil.copy(filename, image_path)
162 os.chmod(image_path, perms) 162 os.chmod(image_path, perms)
163 163
164 if thumb: 164 if thumb:
165 thumb.seek(0) 165 thumb.seek(0)
166 shutil.copyfileobj(thumb, thumb_path) 166 with open(thumb_path, 'wb') as out:
167 out.write(thumb.getvalue())
167 os.chmod(thumb_path, perms) 168 os.chmod(thumb_path, perms)
168 169
169 # Generate URLs for the image and thumb. 170 # Generate URLs for the image and thumb.
170 image_url = _user_photo_url(image_name) 171 image_url = _user_photo_url(image_name)
171 thumb_url = _user_photo_url(thumb_name) 172 thumb_url = _user_photo_url(thumb_name)