コード例 #1
0
 def process(self, importFile=None):
     self.status = 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.copyfile(importFile, self.getImagePath())
     self.makeThumbnail(settings.GEOCAM_CORE_GALLERY_THUMB_SIZE)
     self.makeThumbnail(settings.GEOCAM_CORE_DESC_THUMB_SIZE)
コード例 #2
0
ファイル: models.py プロジェクト: geocam/geocamLensWeb
 def process(self, importFile=None):
     self.status = 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.copyfile(importFile, self.getImagePath())
     self.makeThumbnail(settings.GEOCAM_AWARE_GALLERY_THUMB_SIZE)
     self.makeThumbnail(settings.GEOCAM_AWARE_DESC_THUMB_SIZE)
コード例 #3
0
ファイル: models.py プロジェクト: trey0/geocamLensWeb
 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))
コード例 #4
0
 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))
コード例 #5
0
ファイル: models.py プロジェクト: geocam/geocamLensWeb
    def makeThumbnail0(self, previewOriginalPath, thumbSize):
        maxOutWidth, maxOutHeight = thumbSize
        if previewOriginalPath is None:
            return
        thumbPath = self.getThumbnailPath(maxOutWidth)
        if os.path.exists(thumbPath):
            thumbMtime = os.stat(thumbPath)[stat.ST_MTIME]
            fullMtime = os.stat(previewOriginalPath)[stat.ST_MTIME]
            if fullMtime < thumbMtime:
                return

        im = PIL.Image.open(previewOriginalPath)
        fullWidth, fullHeight = im.size
        thumbWidth, thumbHeight = \
            self.calcThumbSize(fullWidth, fullHeight,
                               maxOutWidth, maxOutHeight)
        try:
            im.thumbnail((thumbWidth, thumbHeight), PIL.Image.ANTIALIAS)
        except IOError:
            # fall back to resize
            im.resize((thumbWidth, thumbHeight), PIL.Image.ANTIALIAS)
        mkdirP(self.getDir())
        im.save(self.getThumbnailPath(maxOutWidth))
コード例 #6
0
ファイル: models.py プロジェクト: imclab/geocamLensWeb
    def makeThumbnail0(self, previewOriginalPath, thumbSize):
        maxOutWidth, maxOutHeight = thumbSize
        if previewOriginalPath is None:
            return
        thumbPath = self.getThumbnailPath(maxOutWidth)
        if os.path.exists(thumbPath):
            thumbMtime = os.stat(thumbPath)[stat.ST_MTIME]
            fullMtime = os.stat(previewOriginalPath)[stat.ST_MTIME]
            if fullMtime < thumbMtime:
                return

        im = PIL.Image.open(previewOriginalPath)
        fullWidth, fullHeight = im.size
        thumbWidth, thumbHeight = \
            self.calcThumbSize(fullWidth, fullHeight,
                               maxOutWidth, maxOutHeight)
        try:
            im.thumbnail((thumbWidth, thumbHeight), PIL.Image.ANTIALIAS)
        except IOError:
            # fall back to resize
            im.resize((thumbWidth, thumbHeight), PIL.Image.ANTIALIAS)
        mkdirP(self.getDir())
        im.save(self.getThumbnailPath(maxOutWidth))