コード例 #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
ファイル: shorten.py プロジェクト: allaud/cropme-server
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
ファイル: shorten.py プロジェクト: allaud/cropme-server
def path_to_short(path):
    id = redis.incr(_key("ID"))
    short_id = short(id)
    redis.set(_key(short_id), path)
    return short_id