コード例 #1
0
    def getattr(self, path):
        """
		Returns node attributes
		"""

        dbg.log("*** getattr %s", path)

        try:
            if isImage(path):
                fname = self._getCacheFilename(path)
                dbg.log("fname: %s", fname)

                if not os.path.exists(fname):
                    st = os.stat(self.root + path)
                else:
                    st = os.stat(fname)
                    # endif
            else:
                st = os.stat(self.root + path)
                # endif
        except:
            dbg.logTB()
            # endtry

        return st
コード例 #2
0
    def getattr(self, path):
        """
		Returns node attributes
		"""

        dbg.log('*** getattr %s', path)

        try:
            if (isImage(path)):
                fname = self._getCacheFilename(path)
                dbg.log('fname: %s', fname)

                if (not os.path.exists(fname)):
                    st = os.stat(self.root + path)
                else:
                    st = os.stat(fname)
                #endif
            else:
                st = os.stat(self.root + path)
            #endif
        except:
            dbg.logTB()
        #endtry

        return st
コード例 #3
0
def resizeImage(src, dest, width, height, quality):
    """
	Resizes images
	"""
    try:
        im = Image.open(src)
        im.thumbnail((width, height), Image.ANTIALIAS)
        p = src.rfind(".")
        if p != -1:
            ext = src[p + 1 :].lower()
            im.save(dest, {"jpg": "JPEG", "jpeg": "JPEG", "png": "PNG"}[ext], quality=int(quality))
        else:
            raise Exception("Unknown extension")
            # endif
    except:
        dbg.logTB()
        raise
コード例 #4
0
def resizeImage(src, dest, width, height, quality):
    """
	Resizes images
	"""
    try:
        im = Image.open(src)
        im.thumbnail((width, height), Image.ANTIALIAS)
        p = src.rfind('.')
        if (p != -1):
            ext = src[p + 1:].lower()
            im.save(dest, {
                'jpg': 'JPEG',
                'jpeg': 'JPEG',
                'png': 'PNG'
            }[ext],
                    quality=int(quality))
        else:
            raise Exception('Unknown extension')
        #endif
    except:
        dbg.logTB()
        raise