示例#1
0
def compress(short_id):
    path = '%s/%s' % (dest_dir, short_to_path(short_id), )
    im = Image.open(path)
    im = im.resize([int(0.5 * s) for s in im.size], Image.ANTIALIAS)
    im.save(path, quality=100)
    inc_view_count(short_id)
    return 'ok'
示例#2
0
def compress(short_id):
    path = '%s/%s' % (dest_dir, short_to_path(short_id), )
    im = Image.open(path)
    im = im.resize([int(0.5 * s) for s in im.size], Image.ANTIALIAS)
    im.save(path, quality=100)
    inc_view_count(short_id)
    return 'ok'
示例#3
0
def view(short_id):
    path = short_to_path(short_id)
    if path is None:
        return ""
    return render_template('view.html', **{
        'path': path,
        'short_id': short_id,
        'view_count': view_count(short_id),
    })
示例#4
0
def view(short_id):
    path = short_to_path(short_id)
    if path is None:
        return ""
    return render_template('view.html', **{
        'path': path,
        'short_id': short_id,
        'view_count': view_count(short_id),
    })
示例#5
0
def shorten(long_id):
    path = short_to_path(long_id)
    if not path:
        return
    short_id = path_to_short(path)
    return redirect(url_mask % short_id)
示例#6
0
def pencil(short_id):
    path = short_to_path(short_id)
    if path is None:
        return ""
    return render_template('pencil.html', **{'path': path})
示例#7
0
def shorten(long_id):
    path = short_to_path(long_id)
    if not path:
        return
    short_id = path_to_short(path)
    return redirect(url_mask % short_id)
示例#8
0
def pencil(short_id):
    path = short_to_path(short_id)
    if path is None:
        return ""
    return render_template('pencil.html', **{'path': path})