def makeThumbnail(self, original_id, repthumb,size=200):
  """
  Makes a thumbnail image given an image Id when called on a Zope
  folder.

  The thumbnail is a Zope image object that is a small JPG
  representation of the original image. The thumbnail has a
  'original_id' property set to the id of the full size image
  object.
  """

  from PIL import Image
  from StringIO import StringIO
  import os.path

  # create a thumbnail image file
  original_image=getattr(self, original_id)
  original_file=StringIO(str(original_image.data))
  image=Image.open(original_file)
  image=image.convert('RGB')
  image.thumbnail((size,size))
  thumbnail_file=StringIO()
  image.save(thumbnail_file, "JPEG") 
  thumbnail_file.seek(0)
  thumbnails=getattr(self,repthumb)
##  for i in self.objectValues('Folder'):
##      if i.getId()=='thumbnails':
##          thumbnails=i
  # create an id for the thumbnail
##  path, ext=os.path.splitext(original_id)
##  thumbnail_id=path + '.thumb.jpg'
  thumbnail_id=original_id
  # if there's and old thumbnail, delete it
  if thumbnail_id in thumbnails.objectIds():
      thumbnails.manage_delObjects([original_id])

  # create the Zope image object
  thumbnails.manage_addProduct['OFSP'].manage_addImage(thumbnail_id,
                                                 thumbnail_file,
                                                 'thumbnail image')
  thumbnail_image=getattr(self, thumbnail_id)

  # set the 'originial_id' property
  #thumbnail_image.manage_addProperty('original_id', original_id, 'string')

