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)
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)
def large_path(self): return helpers.gen_thumb_url(self.path, (1024, 0))
def middle_path(self): return helpers.gen_thumb_url(self.path, (512, 0))
def small_path(self): return helpers.gen_thumb_url(self.path, (256, 0))