Beispiel #1
0
def manualupload():
    image = request.files.get('image', None)
    im = Image.open(image)
    path = image_path(im.tostring(), local.pref_dir)
    short_id = path_to_long(path)
    im.save('%s/%s' % (dest_dir, path, ), "PNG")
    return redirect(url_mask % short_id)
Beispiel #2
0
def manualupload():
    image = request.files.get('image', None)
    im = Image.open(image)
    path = image_path(im.tostring(), local.pref_dir)
    short_id = path_to_long(path)
    im.save('%s/%s' % (dest_dir, path, ), "PNG")
    return redirect(url_mask % short_id)
Beispiel #3
0
def upload(content=None):
    if request.form.get('image', None) is None:
        return "error"
    image = request.form.get('image', None)
    raw_image = decode(image)
    path = image_path(raw_image, local.pref_dir)
    short_id = path_to_long(path)

    save_path = '%s/%s' % (dest_dir, path, )
    _write(save_path, raw_image)

    if request.form.get('retina', None):
        im = Image.open(save_path)
        im = im.resize([int(0.5 * s) for s in im.size], Image.ANTIALIAS)
        im.save(path, quality=100)

    return url_mask % short_id
Beispiel #4
0
def upload(content=None):
    if request.form.get('image', None) is None:
        return "error"
    image = request.form.get('image', None)
    raw_image = decode(image)
    path = image_path(raw_image, local.pref_dir)
    short_id = path_to_long(path)

    save_path = '%s/%s' % (dest_dir, path, )
    _write(save_path, raw_image)

    if request.form.get('retina', None):
        im = Image.open(save_path)
        im = im.resize([int(0.5 * s) for s in im.size], Image.ANTIALIAS)
        im.save(path, quality=100)

    return url_mask % short_id