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)))
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
def image(image_id): image = Image.get_by_id(image_id) return render_template("image.html", image=image)