예제 #1
0
def image_path(raw_image, prefix=''):
    path = datetime.now().strftime("%y/%m/%d")
    parts = path.split("/")
    parts = map(lambda x: short(int(x)), parts)
    image_name = md5(raw_image).hexdigest()[:8]
    return "%s/%s/%s.png" % (
        prefix,
        "/".join(parts),
        image_name,
    )
예제 #2
0
def image_path(raw_image, prefix=''):
    path = datetime.now().strftime("%y/%m/%d")
    parts =  path.split("/")
    parts = map(lambda x: short(int(x)), parts)
    image_name = md5(raw_image).hexdigest()[:8]
    return  "%s/%s/%s.png" % (prefix, "/".join(parts), image_name, )
예제 #3
0
def path_to_short(path):
    id = redis.incr(_key("ID"))
    short_id = short(id)
    redis.set(_key(short_id), path)
    return short_id
예제 #4
0
def path_to_short(path):
    id = redis.incr(_key("ID"))
    short_id = short(id)
    redis.set(_key(short_id), path)
    return short_id