[Checkins] SVN: z3c.image/ initial import of z3c.image, wich contains usefull image related stuff, e.g. processing via PIL, more to come

Bernd Dorn bernd.dorn at fhv.at
Thu Aug 17 09:08:42 EDT 2006


Log message for revision 69597:
  initial import of z3c.image, wich contains usefull image related stuff, e.g. processing via PIL, more to come

Changed:
  A   z3c.image/
  A   z3c.image/trunk/
  A   z3c.image/trunk/setup.cfg
  A   z3c.image/trunk/setup.py
  A   z3c.image/trunk/src/
  A   z3c.image/trunk/src/z3c/
  A   z3c.image/trunk/src/z3c/__init__.py
  A   z3c.image/trunk/src/z3c/image/
  A   z3c.image/trunk/src/z3c/image/SETUP.cfg
  A   z3c.image/trunk/src/z3c/image/__init__.py
  A   z3c.image/trunk/src/z3c/image/configure.zcml
  A   z3c.image/trunk/src/z3c/image/proc/
  A   z3c.image/trunk/src/z3c/image/proc/BROWSER.txt
  A   z3c.image/trunk/src/z3c/image/proc/README.txt
  A   z3c.image/trunk/src/z3c/image/proc/__init__.py
  A   z3c.image/trunk/src/z3c/image/proc/adapter.py
  A   z3c.image/trunk/src/z3c/image/proc/browser.py
  A   z3c.image/trunk/src/z3c/image/proc/configure.zcml
  A   z3c.image/trunk/src/z3c/image/proc/ftesting.zcml
  A   z3c.image/trunk/src/z3c/image/proc/ftests.py
  A   z3c.image/trunk/src/z3c/image/proc/interfaces.py
  A   z3c.image/trunk/src/z3c/image/proc/tests.py
  A   z3c.image/trunk/src/z3c/image/testing/
  A   z3c.image/trunk/src/z3c/image/testing/__init__.py
  A   z3c.image/trunk/src/z3c/image/testing/data/
  A   z3c.image/trunk/src/z3c/image/testing/data/flower.jpg
  A   z3c.image/trunk/src/z3c/image/z3c.image-configure.zcml

-=-
Added: z3c.image/trunk/setup.cfg
===================================================================
--- z3c.image/trunk/setup.cfg	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/setup.cfg	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,3 @@
+[egg_info]
+tag_build = .dev
+tag_svn_revision = 1


Property changes on: z3c.image/trunk/setup.cfg
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.image/trunk/setup.py
===================================================================
--- z3c.image/trunk/setup.py	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/setup.py	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,22 @@
+from setuptools import setup, find_packages
+
+setup(
+    name = "z3c.image",
+    version = "0.1",
+    author = "Zope Contributors",
+    author_email = "office at mopacreative.com",
+    description = "Image utils for zope3",
+    license = "ZPL 2.1",
+    keywords = "zope3 image",
+    url='http://svn.zope.org/z3c.image',
+    classifiers = [
+        'Development Status :: 3 - Alpha',
+        "License :: OSI Approved :: Zope Public License",
+        "Framework :: Zope :: UI",
+        ],
+    packages = find_packages('src'),
+    include_package_data = True,
+    package_dir = {'':'src'},
+    namespace_packages = ['z3c'],
+    zip_safe=False,
+    )


Property changes on: z3c.image/trunk/setup.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/__init__.py
===================================================================
--- z3c.image/trunk/src/z3c/__init__.py	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/__init__.py	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,6 @@
+try:
+    # Declare this a namespace package if pkg_resources is available.
+    import pkg_resources
+    pkg_resources.declare_namespace('z3c')
+except ImportError:
+    pass


Property changes on: z3c.image/trunk/src/z3c/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/SETUP.cfg
===================================================================
--- z3c.image/trunk/src/z3c/image/SETUP.cfg	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/SETUP.cfg	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,3 @@
+<data-files zopeskel/etc/package-includes>
+    z3c.image-*.zcml
+</data-files>
\ No newline at end of file


Property changes on: z3c.image/trunk/src/z3c/image/SETUP.cfg
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/__init__.py
===================================================================
--- z3c.image/trunk/src/z3c/image/__init__.py	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/__init__.py	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1 @@
+#package


Property changes on: z3c.image/trunk/src/z3c/image/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/configure.zcml
===================================================================
--- z3c.image/trunk/src/z3c/image/configure.zcml	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/configure.zcml	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,6 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="zope"
+ >
+ <include package=".proc"/>
+</configure>


Property changes on: z3c.image/trunk/src/z3c/image/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/proc/BROWSER.txt
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/BROWSER.txt	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/proc/BROWSER.txt	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,75 @@
+=======================
+ Processed Image Views
+=======================
+
+
+   >>> from zope.testbrowser.testing import Browser
+   >>> from z3c.image.testing import dataDir
+   >>> import os
+   >>> from zope.app.file.image import getImageInfo
+   >>> imagePath = os.path.join(dataDir, 'flower.jpg')
+   >>> browser = Browser()
+   >>> browser.handleErrors = False
+   >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+   >>> browser.open('http://localhost/@@contents.html')
+   >>> link = browser.getLink('Image')
+   >>> link.click()
+   >>> dataCtrl = browser.getControl('Data')
+   >>> dataCtrl.add_file(file(imagePath), 'image/jpeg', 'flower.jpg')
+   >>> browser.getControl('Add').click()
+
+Let us upen the standard view of the image
+
+   >>> browser.open('http://localhost/flower.jpg')
+   >>> getImageInfo(browser.contents)
+   ('image/jpeg', 103, 118)
+
+
+If we do not specify parameters then the image is not processed.
+
+   >>> browser.open('http://localhost/flower.jpg/@@resized')
+   >>> getImageInfo(browser.contents)
+   ('image/jpeg', 103, 118)
+
+The resized view always keeps the aspect ratio.
+
+   >>> browser.open('http://localhost/flower.jpg/@@resized?w=50')
+   >>> getImageInfo(browser.contents)
+   ('image/jpeg', 50, 57)
+
+Also if width and height are given. In this case the values are taken
+as maximums.
+
+   >>> browser.open('http://localhost/flower.jpg/@@resized?w=50&h=50')
+   >>> getImageInfo(browser.contents)
+   ('image/jpeg', 44, 50)
+
+
+   >>> browser.open('http://localhost/flower.jpg/@@resized?w=20&h=50')
+   >>> getImageInfo(browser.contents)
+   ('image/jpeg', 20, 23)
+
+There is also a prcessorview, which does processing in the folloing order:
+
+ 1. rotate
+ 2. resize
+ 3. crop
+
+If we supply not values the original image is returned.
+
+   >>> browser.open('http://localhost/flower.jpg/@@processed')
+   >>> getImageInfo(browser.contents)
+   ('image/jpeg', 103, 118)
+
+Let us crop the top left 10x10px out of the image.
+
+   >>> browser.open('http://localhost/flower.jpg/@@processed?' +
+   ...     'local.crop.h=10&' +
+   ...     'local.crop.w=10&' +
+   ...     'local.crop.x=0&' +
+   ...     'local.crop.y=0&' 
+   ...     )
+   >>> getImageInfo(browser.contents)
+   ('image/jpeg', 10, 10)
+
+TODO: more tests here


Property changes on: z3c.image/trunk/src/z3c/image/proc/BROWSER.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/proc/README.txt
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/README.txt	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/proc/README.txt	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,56 @@
+========================
+Image Processing Adapter
+========================
+
+  >>> from z3c.image import testing
+  >>> from z3c.image.proc.adapter import ProcessableImage
+  >>> from z3c.image.proc.interfaces import IProcessableImage
+  >>> image = testing.getTestImage('flower.jpg')
+  >>> image.contentType
+  'image/jpeg'
+
+  >>> image.getImageSize()
+  (103, 118)
+
+In order to do some processing we have to register the adapter
+
+  >>> from zope import component
+  >>> component.provideAdapter(ProcessableImage)
+
+  >>> pimg = IProcessableImage(image)
+
+Let us rotate the image
+  >>> pimg.rotate(90)
+
+To get a processed image we call the process method
+
+  >>> res = pimg.process()
+  >>> res
+  <zope.app.file.image.Image object at ...>
+
+  >>> res.getImageSize()
+  (118, 103)
+
+The command queue stays when processed is called, but it is always
+called on the same original image. To reset the command queue, use the
+reset method. If no processing is done the original context is returned.
+
+  >>> pimg.reset()
+  >>> pimg.process() is image
+  True
+
+Resizing is also possible.
+
+  >>> pimg.resize([20,30])
+  >>> res = pimg.process()
+  >>> res.getImageSize()
+  (20, 30)
+
+You can append another command to the processing. The commands are
+processed in the order they have been aplied.
+
+  >>> pimg.rotate(90)
+  >>> res = pimg.process()
+  >>> res.getImageSize()
+  (30, 20)
+


Property changes on: z3c.image/trunk/src/z3c/image/proc/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/proc/__init__.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/__init__.py	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/proc/__init__.py	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1 @@
+#package


Property changes on: z3c.image/trunk/src/z3c/image/proc/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/proc/adapter.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/adapter.py	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/proc/adapter.py	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,63 @@
+from zope.interface import implements
+from zope import component
+from zope.app.file import Image
+from zope.app.file.interfaces import IImage
+from zope.cachedescriptors.property import readproperty
+from PIL import Image as PILImage
+from cStringIO import StringIO
+from interfaces import IProcessableImage
+from PIL import ImageFile
+# see http://mail.python.org/pipermail/image-sig/2003-May/002228.html
+ImageFile.MAXBLOCK = 1024*1024
+
+class ProcessableImage(object):
+
+    component.adapts(IImage)
+    implements(IProcessableImage)
+
+    def __init__(self,image):
+        self.context = image
+        self.format = image.contentType.split('/')[1]
+        self.cmds = []
+
+    @readproperty
+    def pimg(self):
+        return PILImage.open(StringIO(self.context.data))
+        
+    def _toImage(self,*args,**kw):
+        """returns an Image object from the given PIL image"""
+        data = StringIO()
+        try:
+            self.pimg.save(data,self.format,*args,**kw)
+        except IOError:
+            # retry without optimization
+            kw.pop('optimize')
+            self.pimg.save(data,self.format,*args,**kw)
+        return Image(data.getvalue())
+
+    def rotate(self, degrees):
+        self.cmds.append(('rotate',[degrees],{}))
+
+    def crop(self, croparea):
+        croparea = map(int,croparea)
+        self.cmds.append(('crop',[croparea],{}))
+    
+    def resize(self, size):
+        """See IPILImageResizeUtility"""
+        size = map(int,size)
+        self.cmds.append(('resize',[size],{}))
+
+    def reset(self):
+        self.cmds=[]
+        
+    def process(self,quality=90,optimize=1):
+        """processes the command queue and returns the image"""
+        if not self.cmds:
+            return self.context
+        for name,args,kwords in self.cmds:
+            func = getattr(self.pimg,name)
+            self.pimg = func(*args,**kwords)
+        return self._toImage(quality=quality,optimize=optimize)
+
+        
+        


Property changes on: z3c.image/trunk/src/z3c/image/proc/adapter.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/proc/browser.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/browser.py	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/proc/browser.py	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,113 @@
+from zope.app.publisher.browser import BrowserView
+from cStringIO import StringIO
+from zope.app.file import Image
+from interfaces import IProcessableImage
+from zope.dublincore.interfaces import IZopeDublinCore
+import zope.datetime 
+import time
+from datetime import datetime
+
+def _getNewSize(image_size, desired_size, keep_aspect):
+    """Resizes image_size to desired_size, optionally keeping the
+    aspect ratio.
+    """
+    if keep_aspect:
+        x_ratio = float(desired_size[0])/image_size[0]
+        y_ratio = float(desired_size[1])/image_size[1]
+        if x_ratio < y_ratio:
+            new_size = (round(x_ratio*image_size[0]),
+                        round(x_ratio*image_size[1]))
+        else:
+            new_size = (round(y_ratio*image_size[0]),
+                        round(y_ratio*image_size[1]))
+        return new_size
+    else:
+        return desired_size
+
+class ImageProcessorView(BrowserView):
+
+    """image processor"""
+    
+    def __init__(self,context,request):
+        super(ImageProcessorView,self).__init__(context,request)
+        self.degrees =int(self.request.form.get('remote.adjust.rotate',0))
+        self.width = int(self.request.form.get('remote.size.w',0))
+        self.height = int(self.request.form.get('remote.size.h',0))
+
+        self.cropX = self.request.form.get('local.crop.x',None)
+        self.cropW = self.request.form.get('local.crop.w',None)
+        self.cropY = self.request.form.get('local.crop.y',None)
+        self.cropH = self.request.form.get('local.crop.h',None)
+        
+        self.size = (self.width,self.height)
+
+    def _process(self):
+
+        pimg = IProcessableImage(self.context)
+
+        if self.degrees > 0:
+            pimg.rotate(self.degrees)
+        if self.width and self.height:
+            pimg.resize(self.size)
+            
+        if self.cropX is not None and self.cropY is not None \
+           and self.cropW is not None and self.cropH is not None:
+            
+            self.croparea = (int(self.cropX),
+                             int(self.cropY),
+                             int(self.cropX) + int(self.cropW),
+                             int(self.cropY) + int(self.cropH))
+            pimg.crop(self.croparea)
+
+        return pimg.process()
+
+    def processed(self):
+        processed = self._process()
+        if self.request is not None:
+            self.request.response.setHeader('Content-Type',
+                                            processed.contentType)
+            self.request.response.setHeader('Content-Length',
+                                            processed.getSize())
+        return processed.data
+
+    def __call__(self):
+        try:
+            modified = IZopeDublinCore(self.context).modified
+        except TypeError:
+            modified=None
+        if modified is None or not isinstance(modified,datetime):
+            return self.processed()
+        header= self.request.getHeader('If-Modified-Since', None)
+        lmt = long(time.mktime(modified.timetuple()))
+        if header is not None:
+            header = header.split(';')[0]
+            try:    mod_since=long(zope.datetime.time(header))
+            except: mod_since=None
+            if mod_since is not None:
+                if lmt <= mod_since:
+                    self.request.response.setStatus(304)
+                    return ''
+        self.request.response.setHeader('Last-Modified',
+                                        zope.datetime.rfc1123_date(lmt))
+        return self.processed()
+            
+        
+class ResizedImageView(ImageProcessorView):
+
+    def __init__(self,context,request):
+        super(ResizedImageView,self).__init__(context,request)
+        self.size = self.context.getImageSize()
+        self.width = self.request.form.get('w',self.size[0])
+        self.height = self.request.form.get('h',self.size[1])
+
+    def _process(self):
+
+        pimg = IProcessableImage(self.context)
+        
+        new_size = _getNewSize(self.size, (self.width, self.height),
+                               keep_aspect=True)
+        if new_size != self.size:
+            pimg.resize(new_size)
+        return pimg.process()
+
+


Property changes on: z3c.image/trunk/src/z3c/image/proc/browser.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/proc/configure.zcml
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/configure.zcml	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/proc/configure.zcml	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,22 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ i18n_domain="zope"
+ >
+
+ <adapter factory=".adapter.ProcessableImage"/>
+ 
+ <browser:page
+  for="zope.app.file.interfaces.IImage"
+  name="resized"
+  permission="zope.Public"
+  class=".browser.ResizedImageView"/>
+
+ <browser:page
+  for="zope.app.file.interfaces.IImage"
+  name="processed"
+  permission="zope.Public"
+  class=".browser.ImageProcessorView"
+  />
+ 
+</configure>


Property changes on: z3c.image/trunk/src/z3c/image/proc/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/proc/ftesting.zcml
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/ftesting.zcml	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/proc/ftesting.zcml	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,34 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:browser="http://namespaces.zope.org/browser"
+           i18n_domain="zope">
+  <include package="zope.app" />
+  <include package="zope.app.server" />
+  <include package="zope.app.authentication" />
+  <include package="zope.app.securitypolicy" file="meta.zcml" />
+  <securityPolicy
+    component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+  <include package="zope.app.securitypolicy" />
+  <include package="zope.app.file"/>
+  <include package="z3c.image.proc"/>
+  <!-- we ought to use this for the tests
+  <include package="zope.app.i18n.tests" />
+  -->
+
+  <role id="zope.Anonymous" title="Everybody"
+                 description="All users have this role implicitly" />
+  <role id="zope.Manager" title="Site Manager" />
+  <role id="zope.Member" title="Site Member" />
+  <grantAll role="zope.Manager" />
+
+  <principal
+      id="zope.manager"
+      title="Administrator"
+      login="mgr"
+      password="mgrpw" />
+
+  <grant
+    role="zope.Manager"
+    principal="zope.manager"
+    />
+
+</configure>
\ No newline at end of file


Property changes on: z3c.image/trunk/src/z3c/image/proc/ftesting.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/proc/ftests.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/ftests.py	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/proc/ftests.py	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,13 @@
+from zope.app.testing import functional
+
+functional.defineLayer('TestLayer', 'ftesting.zcml')
+
+def test_suite():
+    suite = functional.FunctionalDocFileSuite(
+        'BROWSER.txt',
+        )
+    suite.layer = TestLayer
+    return suite
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: z3c.image/trunk/src/z3c/image/proc/ftests.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/proc/interfaces.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/interfaces.py	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/proc/interfaces.py	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,19 @@
+from zope.interface import Interface
+
+class IProcessableImage(Interface):
+
+    def process():
+        """returns the processed image"""
+
+    def rotate(degrees):
+
+        """rotates the image by degrees"""
+
+    def resize(size):
+
+        """resizes the image to (w,h)"""
+        
+    def crop(croparea):
+
+        """ crops the image """
+        


Property changes on: z3c.image/trunk/src/z3c/image/proc/interfaces.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/proc/tests.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/tests.py	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/proc/tests.py	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,27 @@
+import doctest
+import unittest
+from zope.testing.doctestunit import DocFileSuite, DocTestSuite
+from zope.app.testing import setup
+from zope import component
+
+def setUp(test):
+    setup.placefulSetUp()
+
+
+def tearDown(test):
+    setup.placefulTearDown()
+
+
+def test_suite():
+    
+    return unittest.TestSuite(
+        (
+        DocFileSuite('README.txt',
+                     optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+                     ),
+        ))
+
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')
+


Property changes on: z3c.image/trunk/src/z3c/image/proc/tests.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/testing/__init__.py
===================================================================
--- z3c.image/trunk/src/z3c/image/testing/__init__.py	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/testing/__init__.py	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1,10 @@
+#testing package
+import os
+from zope.app.file.image import Image
+
+dataDir = os.path.join(os.path.dirname(__file__),'data')
+
+def getTestImage(name):
+    """returns a zope image with the given name from this directory"""
+    path = os.path.join(dataDir,name)
+    return Image(file(path))


Property changes on: z3c.image/trunk/src/z3c/image/testing/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.image/trunk/src/z3c/image/testing/data/flower.jpg
===================================================================
(Binary files differ)


Property changes on: z3c.image/trunk/src/z3c/image/testing/data/flower.jpg
___________________________________________________________________
Name: svn:mime-type
   + image/jpeg

Added: z3c.image/trunk/src/z3c/image/z3c.image-configure.zcml
===================================================================
--- z3c.image/trunk/src/z3c/image/z3c.image-configure.zcml	2006-08-17 12:52:02 UTC (rev 69596)
+++ z3c.image/trunk/src/z3c/image/z3c.image-configure.zcml	2006-08-17 13:08:41 UTC (rev 69597)
@@ -0,0 +1 @@
+<include package="z3c.image"/>
\ No newline at end of file


Property changes on: z3c.image/trunk/src/z3c/image/z3c.image-configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list