Update of /cvsroot/freevo/freevo/src/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7744/src/util

Modified Files:
        fileops.py 
Log Message:
handle PIL exception

Index: fileops.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/fileops.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** fileops.py  29 Jun 2004 18:08:56 -0000      1.23
--- fileops.py  4 Jul 2004 08:04:21 -0000       1.24
***************
*** 11,14 ****
--- 11,17 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.24  2004/07/04 08:04:21  dischi
+ # handle PIL exception
+ #
  # Revision 1.23  2004/06/29 18:08:56  dischi
  # use vfs.open to make sure we can write
***************
*** 518,535 ****
                  return None
          
!     if image.size[0] > 255 or image.size[1] > 255:
!         image.thumbnail((255,255), Image.ANTIALIAS)
! 
!     if image.mode == 'P':
!         image = image.convert('RGB')
  
!     data = (image.tostring(), image.size, image.mode)
  
!     f = vfs.open(thumb, 'w')
!     f.write('FRI%s%s%5s' % (chr(image.size[0]), chr(image.size[1]), image.mode))
!     f.write(data[0])
!     f.close()
!     return data
  
  
  def cache_image(filename, thumbnail=None, use_exif=False):
--- 521,544 ----
                  return None
          
!     try:
!         if image.size[0] > 255 or image.size[1] > 255:
!             image.thumbnail((255,255), Image.ANTIALIAS)
  
!         if image.mode == 'P':
!             image = image.convert('RGB')
  
!         data = (image.tostring(), image.size, image.mode)
  
+         f = vfs.open(thumb, 'w')
+         f.write('FRI%s%s%5s' % (chr(image.size[0]), chr(image.size[1]), image.mode))
+         f.write(data[0])
+         f.close()
+         return data
+     except Exception, e:
+         print 'error caching image %s' % filename
+         if config.DEBUG:
+             print e
+         return None
+         
  
  def cache_image(filename, thumbnail=None, use_exif=False):



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to