[Checkins] SVN: z3c.image/trunk/ bugfix; prepare for release

Bernd Roessl bernd.roessl at lovelysystems.com
Wed Feb 13 19:46:03 EST 2008


Log message for revision 83808:
  bugfix; prepare for release

Changed:
  U   z3c.image/trunk/CHANGES.txt
  U   z3c.image/trunk/setup.py
  U   z3c.image/trunk/src/z3c/image/proc/BROWSER.txt
  U   z3c.image/trunk/src/z3c/image/proc/browser.py

-=-
Modified: z3c.image/trunk/CHANGES.txt
===================================================================
--- z3c.image/trunk/CHANGES.txt	2008-02-13 19:12:08 UTC (rev 83807)
+++ z3c.image/trunk/CHANGES.txt	2008-02-14 00:46:02 UTC (rev 83808)
@@ -2,6 +2,12 @@
 Changes for z3c.image
 =====================
 
+2008/02/14 0.1.7:
+=================
+
+- bugfix: resizing did not longer work correctly in release 0.1.6
+
+
 2008/02/05 0.1.6:
 =================
 

Modified: z3c.image/trunk/setup.py
===================================================================
--- z3c.image/trunk/setup.py	2008-02-13 19:12:08 UTC (rev 83807)
+++ z3c.image/trunk/setup.py	2008-02-14 00:46:02 UTC (rev 83808)
@@ -2,7 +2,7 @@
 
 setup(
     name = "z3c.image",
-    version = "0.1.6",
+    version = "0.1.7",
     author = "Zope Contributors",
     author_email = "office at mopacreative.com",
     description = "Image utils for zope3",

Modified: z3c.image/trunk/src/z3c/image/proc/BROWSER.txt
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/BROWSER.txt	2008-02-13 19:12:08 UTC (rev 83807)
+++ z3c.image/trunk/src/z3c/image/proc/BROWSER.txt	2008-02-14 00:46:02 UTC (rev 83808)
@@ -106,6 +106,15 @@
    >>> getImageInfo(browser.contents)
    ('image/jpeg', 10, 5)
 
+And now without a crop::
+
+   >>> browser.open('http://localhost/flower.jpg/@@processed?' +
+   ...     'after.size.h=20&' +
+   ...     'after.size.w=10&'
+   ...     )
+   >>> getImageInfo(browser.contents)
+   ('image/jpeg', 10, 11)
+
 It is also possible to omit one dimension of afterSize to keep the resulting
 ratio of the image. If the image get cropped the resulting ratio will be
 apointed by the crop.::

Modified: z3c.image/trunk/src/z3c/image/proc/browser.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/browser.py	2008-02-13 19:12:08 UTC (rev 83807)
+++ z3c.image/trunk/src/z3c/image/proc/browser.py	2008-02-14 00:46:02 UTC (rev 83808)
@@ -78,19 +78,6 @@
             ratio = float(w) / float(h)
         return ratio
 
-    @property
-    def _resultingSize(self):
-        if (    self.cropW is not None
-            and self.cropH is not None
-            and self.cropW != 0
-            and self.cropH != 0
-           ):
-            return (int(self.cropW), int(self.cropH))
-        else:
-            context = removeSecurityProxy(self.context)
-            t,w,h = getImageInfo(context.data)
-            return (int(w), int(h))
-
     def _calcAfterSize(self):
         if (self.afterSizeW == 0 or self.afterSizeH == 0) and \
            self.afterSizeW != self.afterSizeH:
@@ -119,7 +106,14 @@
                              int(self.cropY) + int(self.cropH))
             pimg.crop(self.croparea)
         if self.afterSizeW is not 0 and self.afterSizeH is not 0:
-            size = getMaxSize(self._resultingSize, self.afterSize)
+            if self.cropW and self.cropH:
+                currentSize = (int(self.cropW), int(self.cropH))
+            elif self.width and self.height:
+                currentSize = (self.width, self.height)
+            else:
+                t,w,h = getImageInfo(self.context.data)
+                currentSize = (w, h)
+            size=getMaxSize(currentSize, self.afterSize)
             pimg.resize(size)
         return pimg.process()
 



More information about the Checkins mailing list