Example #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'
Example #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'
Example #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),
    })
Example #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),
    })
Example #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)
Example #6
0
def pencil(short_id):
    path = short_to_path(short_id)
    if path is None:
        return ""
    return render_template('pencil.html', **{'path': path})
Example #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)
Example #8
0
def pencil(short_id):
    path = short_to_path(short_id)
    if path is None:
        return ""
    return render_template('pencil.html', **{'path': path})