Пример #1
0
def image_page(album, filename, template='image'):
    image = Image(album, filename, current_app.config)
    show = Show(album, current_app.config, session)
    exif_manager = ExifManager(image)
    exif_array = exif_manager.get_exif()

    return render_themed(template + '.html', album=album, filename=filename,
                         exif=exif_array, show=show)
Пример #2
0
def image_page(album, filename):
    show = Show(album, current_app.config, session)
    image = Image(album, filename, current_app.config)
    exif_manager = ExifManager(image)
    exif_array = exif_manager.get_exif()
    if exif_array is None:
        exif_array = {}
    return render_themed("image.html", album=album, filename=filename, exif=exif_array, show=show)
Пример #3
0
def image_page(album, filename):
    show = Show(album, current_app.config, session)
    image = Image(album, filename, current_app.config)
    exif_manager = ExifManager(image)
    exif_array = exif_manager.get_exif()
    if exif_array is None:
        exif_array = {}
    return render_themed('image.html', album=album, filename=filename,
                         exif=exif_array, show=show)
Пример #4
0
def image_page(album, filename, template='image'):
    image = Image(album, filename, current_app.config)
    show = Show(album, current_app.config, session)
    exif_manager = ExifManager(image)
    exif_array = exif_manager.get_exif()

    return render_themed(template + '.html',
                         album=album,
                         filename=filename,
                         exif=exif_array,
                         show=show)
Пример #5
0
    def sort_by_exif_datetime(self):
        """Sort the show contents by filename

           Returns:
             self
        """
        filenames = []

        for filename in self.data['files']:
            image = Image(self.album, filename)
            exif_manager = ExifManager(image)
            datetime = exif_manager.get_exif_datetime()
            filenames.append((datetime, filename))

        self.data['files'] = [filename
                              for (datetime, filename)
                              in sorted(filenames)]

        return self
Пример #6
0
    def update(self, size):
        fpath = self.get_path(size)

        if not os.path.exists(fpath):
            adir = os.path.join(self.config['CACHE_DIR'], self.image.album)
            if not os.path.exists(adir):
                os.mkdir(adir)

            tdir = os.path.join(adir, str(int(size)))
            if not os.path.exists(tdir):
                os.mkdir(tdir)

        if not os.path.exists(self.image.exif_file):
            exif = ExifManager(self.image)
            exif.update()

        img = Image.open(self.image.get_fullsize_path())
        img.thumbnail((int(size), int(size)), Image.ANTIALIAS)
        img.save(self.get_path(size), 'JPEG')
Пример #7
0
    def sort_by_exif_datetime(self):
        """Sort the show contents by filename

           Returns:
             self
        """
        filenames = []

        for filename in self.data['files']:
            image = Image(self.album, filename, config=self.config)
            exif_manager = ExifManager(image)
            datetime = exif_manager.get_exif_datetime()
            filenames.append((datetime, filename))

        self.data['files'] = [
            filename for (datetime, filename) in sorted(filenames)
        ]

        return self
Пример #8
0
    def update(self, size):
        fpath = self.get_path(size)

        if not os.path.exists(fpath):
            adir = os.path.join(self.config['CACHE_DIR'],
                                self.image.album)
            if not os.path.exists(adir):
                os.mkdir(adir)

            tdir = os.path.join(adir, str(int(size)))
            if not os.path.exists(tdir):
                os.mkdir(tdir)

        if not os.path.exists(self.image.exif_file):
            exif = ExifManager(self.image)
            exif.update()

        img = Image.open(self.image.get_fullsize_path())
        img.thumbnail((int(size), int(size)), Image.ANTIALIAS)
        img.save(self.get_path(size), 'JPEG')