mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-17 05:40:25 +00:00
Reset file pointer before opening image. Fixes #47
This commit is contained in:
parent
cfa3d01f54
commit
7e5491cc3e
1 changed files with 1 additions and 6 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import os
|
||||
import tempfile
|
||||
import types
|
||||
|
||||
|
|
@ -35,11 +34,7 @@ def get_spec_files(instance):
|
|||
|
||||
|
||||
def open_image(target):
|
||||
if hasattr(target, 'mode') and 'w' in target.mode and os.path.exists(target.name):
|
||||
# target is a file like object with write mode enabled
|
||||
# PIL will zero this file out and then give and IO error
|
||||
# instead just pass PIL the path
|
||||
target = target.name
|
||||
target.seek(0)
|
||||
img = Image.open(target)
|
||||
img.copy = types.MethodType(_wrap_copy(img.copy), img, img.__class__)
|
||||
return img
|
||||
|
|
|
|||
Loading…
Reference in a new issue