1
2
3
4
5
6
7
8
9
10
   def save(self):
      super(Photo, self).save()
      if self.id is not None and len(self.the_image) >1: 
         import Image
         size = 128, 128
         import sys
         print >>sys.stderr, 'Path is %r ' % (settings.MEDIA_ROOT+'/'+self.the_image)
         img = Image.open(settings.MEDIA_ROOT+'/'+self.the_image).copy()
         img.thumbnail(size, Image.ANTIALIAS)
         img.save(settings.MEDIA_ROOT+'/fred.jpg') #need to fix this bit!