[Checkins] SVN: z3c.image/trunk/ - bugfix: wrong handling of raw
image data im no crop and size info was
Bernd Roessl
bernd.roessl at lovelysystems.com
Fri Feb 15 10:49:58 EST 2008
Log message for revision 83865:
- bugfix: wrong handling of raw image data im no crop and size info was
provided
Changed:
U z3c.image/trunk/CHANGES.txt
U z3c.image/trunk/setup.py
U z3c.image/trunk/src/z3c/image/proc/browser.py
-=-
Modified: z3c.image/trunk/CHANGES.txt
===================================================================
--- z3c.image/trunk/CHANGES.txt 2008-02-15 14:35:44 UTC (rev 83864)
+++ z3c.image/trunk/CHANGES.txt 2008-02-15 15:49:58 UTC (rev 83865)
@@ -2,6 +2,13 @@
Changes for z3c.image
=====================
+2008/02/15 0.1.8:
+=================
+
+- bugfix: wrong handling of raw image data im no crop and size info was
+ provided
+
+
2008/02/14 0.1.7:
=================
Modified: z3c.image/trunk/setup.py
===================================================================
--- z3c.image/trunk/setup.py 2008-02-15 14:35:44 UTC (rev 83864)
+++ z3c.image/trunk/setup.py 2008-02-15 15:49:58 UTC (rev 83865)
@@ -2,7 +2,7 @@
setup(
name = "z3c.image",
- version = "0.1.7",
+ version = "0.1.8",
author = "Zope Contributors",
author_email = "office at mopacreative.com",
description = "Image utils for zope3",
Modified: z3c.image/trunk/src/z3c/image/proc/browser.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/browser.py 2008-02-15 14:35:44 UTC (rev 83864)
+++ z3c.image/trunk/src/z3c/image/proc/browser.py 2008-02-15 15:49:58 UTC (rev 83865)
@@ -65,6 +65,20 @@
self.size = (self.width,self.height)
self._calcAfterSize()
+ @property
+ def data(self):
+ context = removeSecurityProxy(self.context)
+ data = context.data
+ if not isinstance(data, str):
+ pos = data.tell()
+ data.seek(0)
+ res = data.read(1024*1024)
+ data.seek(pos)
+ data = res
+ else:
+ data = context.data
+ return data
+
def _resultingRatio(self):
if ( self.cropW is not None
and self.cropH is not None
@@ -73,8 +87,7 @@
):
ratio = float(self.cropW) / float(self.cropH)
else:
- context = removeSecurityProxy(self.context)
- t,w,h = getImageInfo(context.data)
+ t,w,h = getImageInfo(self.data)
ratio = float(w) / float(h)
return ratio
@@ -111,8 +124,8 @@
elif self.width and self.height:
currentSize = (self.width, self.height)
else:
- t,w,h = getImageInfo(self.context.data)
- currentSize = (w, h)
+ t,w,h = getImageInfo(self.data)
+ currentSize = (w,h)
size=getMaxSize(currentSize, self.afterSize)
pimg.resize(size)
return pimg.process()
More information about the Checkins
mailing list