p3 fixes in applications
This commit is contained in:
@@ -36,11 +36,11 @@ class RESIZE(object):
|
||||
if isinstance(value, str) and len(value) == 0:
|
||||
return (value, None)
|
||||
from PIL import Image
|
||||
import cStringIO
|
||||
from io import BytesIO
|
||||
try:
|
||||
img = Image.open(value.file)
|
||||
img.thumbnail((self.nx, self.ny), Image.ANTIALIAS)
|
||||
s = cStringIO.StringIO()
|
||||
s = BytesIO()
|
||||
if self.padding:
|
||||
background = Image.new('RGBA', (self.nx, self.ny), (255, 255, 255, 0))
|
||||
background.paste(
|
||||
@@ -48,7 +48,7 @@ class RESIZE(object):
|
||||
((self.nx - img.size[0]) / 2, (self.ny - img.size[1]) / 2))
|
||||
background.save(s, 'JPEG', quality=self.quality)
|
||||
else:
|
||||
img.save(s, 'JPEG', queality=self.quality)
|
||||
img.save(s, 'JPEG', quality=self.quality)
|
||||
s.seek(0)
|
||||
value.file = s
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user