Fix image handling problems for reports.

svn: r6269
This commit is contained in:
Brian Matherly
2006-04-05 04:41:56 +00:00
parent 41cec5c783
commit 6769f01be2
4 changed files with 25 additions and 13 deletions

View File

@@ -76,20 +76,26 @@ class ImgManip:
def fmt_data(self, cnv):
fd, dest = tempfile.mkstemp()
self.img.save(dest,cnv)
fh = open(dest)
fh = open(dest,mode='rb')
data = fh.read()
fh.close()
os.unlink(dest)
try:
os.unlink(dest)
except:
pass
return data
def fmt_scale_data(self, x, y, cnv):
fd, dest = tempfile.mkstemp()
scaled = self.img.scale_simple(x, y, gtk.gdk.INTERP_BILINEAR)
self.img.save(dest,cnv)
fh = open(dest)
scaled.save(dest,cnv)
fh = open(dest,mode='rb')
data = fh.read()
fh.close()
os.unlink(dest)
try:
os.unlink(dest)
except:
pass
return data
def jpg_thumbnail(self, dest, width, height):