def ico_pos_new(id, pos=None): if pos == ico_pos.get(id): return f = ico.get(id) if not f: return pic = picopen(fs_get_jpg(PIC_FULL_SIZE, f)) if not pic: return pic_id = pic_new(CID_ICO96, id) if pos: pos_tuple = pos.split("_") if len(pos_tuple) == 3: x, y, size = map(int, pos_tuple) if size: pic = pic_square(pic, size, top_left=(x, y), size=size) pic = pic_square(pic, 96, size=96) fs_set_jpg("96", pic_id, pic) ico_pos.set(id, pos or "") ico96.set(id, pic_id) from model.feed_po import mc_feed_user_dict mc_feed_user_dict.delete(id)
def ico_pos_new(id, pos=None): if pos == ico_pos.get(id): return f = ico.get(id) if not f: return pic = picopen(fs_get_jpg(PIC_FULL_SIZE, f)) if not pic: return pic_id = pic_new(CID_ICO96, id) if pos: pos_tuple = pos.split('_') if len(pos_tuple) == 3: x, y, size = map(int, pos_tuple) if size: pic = pic_square(pic, size, top_left=(x, y), size=size) pic = pic_square(pic, 96, size=96) fs_set_jpg('96', pic_id, pic) ico_pos.set(id, pos or '') ico96.set(id, pic_id) from model.feed_po import mc_feed_user_dict mc_feed_user_dict.delete(id)
def site_ico_new(user_id, pic, site_id=None): pic_id = pic_new_save(CID_SITE_ICO, user_id, pic) p96 = pic_square(pic, 96, size=96) fs_set_jpg("96", pic_id, p96) p211 = pic_resize_width_cut_height_if_large(pic, 211) fs_set_jpg("211", pic_id, p211) return pic_id
def site_ico_new(user_id, pic, site_id=None): pic_id = pic_new_save(CID_SITE_ICO, user_id, pic) p96 = pic_square(pic, 96, size=96) fs_set_jpg('96', pic_id, p96) p211 = pic_resize_width_cut_height_if_large(pic, 211) fs_set_jpg('211', pic_id, p211) return pic_id