mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-04-18 20:21:01 +00:00
patch applied badly, fixing if
This commit is contained in:
parent
34a2640cf5
commit
2b80ccf2e3
1 changed files with 12 additions and 12 deletions
|
|
@ -51,20 +51,20 @@ class Accessor(object):
|
|||
return imgfile
|
||||
|
||||
def _create(self):
|
||||
if self._exists():
|
||||
if self._obj._imgfield:
|
||||
if self._exists():
|
||||
return
|
||||
# process the original image file
|
||||
try:
|
||||
fp = self._obj._imgfield.storage.open(self._obj._imgfield.name)
|
||||
except IOError:
|
||||
return
|
||||
fp.seek(0)
|
||||
fp = StringIO(fp.read())
|
||||
self._img, self._fmt = self.spec.process(Image.open(fp), self._obj)
|
||||
# save the new image to the cache
|
||||
content = ContentFile(self._get_imgfile().read())
|
||||
self._obj._storage.save(self.name, content)
|
||||
# process the original image file
|
||||
try:
|
||||
fp = self._obj._imgfield.storage.open(self._obj._imgfield.name)
|
||||
except IOError:
|
||||
return
|
||||
fp.seek(0)
|
||||
fp = StringIO(fp.read())
|
||||
self._img, self._fmt = self.spec.process(Image.open(fp), self._obj)
|
||||
# save the new image to the cache
|
||||
content = ContentFile(self._get_imgfile().read())
|
||||
self._obj._storage.save(self.name, content)
|
||||
|
||||
def _delete(self):
|
||||
self._obj._storage.delete(self.name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue