Ejemplo n.º 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)
Ejemplo n.º 2
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_AWARE_GALLERY_THUMB_SIZE)
     self.makeThumbnail(settings.GEOCAM_AWARE_DESC_THUMB_SIZE)
Ejemplo n.º 3
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))
Ejemplo n.º 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))
Ejemplo n.º 5
0
    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))
Ejemplo n.º 6
0
    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))