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