2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-18 06:47:09 +00:00

[svn] Switch from photologue to imagekit. Less bloat.

Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8338 by cucc @ 5/11/2009 3:08 AM
This commit is contained in:
substantialnoninfringinguser
2009-05-13 06:24:52 +01:00
parent 8c68a8a0d7
commit b509390575
12 changed files with 604 additions and 0 deletions

15
imagekit/utils.py Normal file
View File

@@ -0,0 +1,15 @@
""" ImageKit utility functions """
import tempfile
def img_to_fobj(img, format, **kwargs):
tmp = tempfile.TemporaryFile()
if format != 'JPEG':
try:
img.save(tmp, format, **kwargs)
return
except KeyError:
pass
img.save(tmp, format, **kwargs)
tmp.seek(0)
return tmp