parameters: (self, hash_, width, height, x, y, mode = 'resize', bg = '', degree = 0)
return_statement: return self.stat(path)
docstring: Resize image. Raises PermissionDeniedError if the command is disabled
          or there is no file 'write' permission. Raises NotAnImageError if
          file is not an image.
docstring_summary: Resize image. Raises PermissionDeniedError if the command is disabled
          or there is no file 'write' permission. Raises NotAnImageError if
          file is not an image.
docstring_tokens: Resize image . Raises PermissionDeniedError if the command is disabled or there is no file write permission . Raises NotAnImageError if file is not an image .
function: def resize(self, hash_, width, height, x, y, mode = 'resize', bg = '', degree = 0):
          """
          Resize image. Raises PermissionDeniedError if the command is disabled
          or there is no file 'write' permission. Raises NotAnImageError if
          file is not an image.
          """
  
          if self.command_disabled('resize'):
              raise PermissionDeniedError
          
          file_ = self.file(hash_)
          
          if not file_['write'] or not file_['read']:
              raise PermissionDeniedError
          
          if not file_['mime'].startswith('image'):
              raise NotAnImageError
  
          path = self.decode(hash_)
          
          try:
              im = self._openimage(path)
          except:
              NotAnImageError
  
          if mode == 'propresize':
              self._img_resize(im, path, width, height, True, True)
          elif mode == 'crop':
              self._img_crop(im, path, width, height, x, y)
          elif mode == 'fitsquare':
              self._img_square_fit(im, path, width, height, bg if bg else self._options['tmbBgColor'])
          elif mode == 'rotate':
              self._img_rotate(im, path, degree, bg if bg else self._options['tmbBgColor'])
          else:
              self._img_resize(im, path, width, height, False, True)
          
          if hasattr(im, 'fp') and im.fp:
              im.fp.close()
  
          self._rm_tmb(file_)
          self._clear_cached_stat(path)
          return self.stat(path)
function_tokens: def resize ( self , hash_ , width , height , x , y , mode = 'resize' , bg = '' , degree = 0 ) : if self . command_disabled ( 'resize' ) : raise PermissionDeniedError file_ = self . file ( hash_ ) if not file_ [ 'write' ] or not file_ [ 'read' ] : raise PermissionDeniedError if not file_ [ 'mime' ] . startswith ( 'image' ) : raise NotAnImageError path = self . decode ( hash_ ) try : im = self . _openimage ( path ) except : NotAnImageError if mode == 'propresize' : self . _img_resize ( im , path , width , height , True , True ) elif mode == 'crop' : self . _img_crop ( im , path , width , height , x , y ) elif mode == 'fitsquare' : self . _img_square_fit ( im , path , width , height , bg if bg else self . _options [ 'tmbBgColor' ] ) elif mode == 'rotate' : self . _img_rotate ( im , path , degree , bg if bg else self . _options [ 'tmbBgColor' ] ) else : self . _img_resize ( im , path , width , height , False , True ) if hasattr ( im , 'fp' ) and im . fp : im . fp . close ( ) self . _rm_tmb ( file_ ) self . _clear_cached_stat ( path ) return self . stat ( path )