예제 #1
0
def delete_image(image_id):

    image = Image.get_by_id(image_id)

    image.delete_image()

    # to save memory we should delete the actual image file as well
    target = os.path.join(APP_ROOT, "static/images/{}".format(image.filename))
    os.remove(target)

    return render_template(
        "gallery.html",
        images=Image.images_from_mongo(current_user.username),
        profile_pic=url_for('static',
                            filename='profile_pics/{}'.format(
                                current_user.profile_image)))
예제 #2
0
def images(image_id):
    image = Image.get_by_id(image_id)
    fr = make_response(image.get_data())
    fr.headers['Content-Type'] = image.get_content_type()
    return fr
예제 #3
0
def image(image_id):
    image = Image.get_by_id(image_id)
    return render_template("image.html", image=image)
예제 #4
0
def images(image_id):
    image = Image.get_by_id(image_id)
    fr = make_response(image.get_data())
    fr.headers['Content-Type'] = image.get_content_type()
    return fr