예제 #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
    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))