def makeThumbnail0(self, previewOriginalPath, thumbSize): maxOutWidth, maxOutHeight = thumbSize if previewOriginalPath is not None and not os.path.exists(self.getThumbnailPath(maxOutWidth)): im = PIL.Image.open(previewOriginalPath) fullWidth, fullHeight = im.size thumbWidth, thumbHeight = self.calcThumbSize(fullWidth, fullHeight, maxOutWidth, maxOutHeight) im.thumbnail((thumbWidth, thumbHeight), PIL.Image.ANTIALIAS) mkdirP(self.getDir()) im.save(self.getThumbnailPath(maxOutWidth))
def process(self, importFile=None): self.status = settings.STATUS_ACTIVE self.processed = True if importFile and not os.path.exists(self.getImagePath()): if not os.path.exists(self.getDir()): mkdirP(self.getDir()) shutil.copy(importFile, self.getImagePath()) self.makeThumbnail(settings.GALLERY_THUMB_SIZE) self.makeThumbnail(settings.DESC_THUMB_SIZE)
def initZipDir(prefix): deleteStaleFiles() zipDir = getTempName(prefix) utils.mkdirP(zipDir) return zipDir