コード例 #1
0
    def cover(self):
        @memcached(self.cover_cache_key)
        def _cover_id():
            images = self.get_images(page=1, limit=1)
            cover_id = config.default_album_cover
            if images:
                cover_id = images[0].id
            return cover_id

        cover = _cover_id()
        # 某一夜,脑残用了 image.id 作为 album 的 cover
        if type(cover) in (int, long):
            image = collipa.models.Image.get(id=cover)
            if image:
                cover = image.path
            else:
                cover = config.default_album_cover
        size = (128, 128)
        return helpers.gen_thumb_url(cover, size)
コード例 #2
0
ファイル: album.py プロジェクト: lansheng228/collipa
    def cover(self):
        @memcached(self.cover_cache_key)
        def _cover_id():
            images = self.get_images(page=1, limit=1)
            cover_id = config.default_album_cover
            if images:
                cover_id = images[0].id
            return cover_id

        cover = _cover_id()
        # 某一夜,脑残用了 image.id 作为 album 的 cover
        if type(cover) in (int, int):
            image = collipa.models.Image.get(id=cover)
            if image:
                cover = image.path
            else:
                cover = config.default_album_cover
        size = (128, 128)
        return helpers.gen_thumb_url(cover, size)
コード例 #3
0
 def large_path(self):
     return helpers.gen_thumb_url(self.path, (1024, 0))
コード例 #4
0
 def middle_path(self):
     return helpers.gen_thumb_url(self.path, (512, 0))
コード例 #5
0
 def small_path(self):
     return helpers.gen_thumb_url(self.path, (256, 0))
コード例 #6
0
ファイル: image.py プロジェクト: iselu/collipa
 def large_path(self):
     return helpers.gen_thumb_url(self.path, (1024, 0))
コード例 #7
0
ファイル: image.py プロジェクト: iselu/collipa
 def middle_path(self):
     return helpers.gen_thumb_url(self.path, (512, 0))
コード例 #8
0
ファイル: image.py プロジェクト: iselu/collipa
 def small_path(self):
     return helpers.gen_thumb_url(self.path, (256, 0))