def image_viewer(images): images = images.rsplit('+') images_list = [] for image in images: image_id = base62.decode(image) image_info = database.Image.query.filter_by(id=image_id).first() images_list.append(image_info) return render_template('viewer.html', images=images_list)
def image_single(image): image = base62.decode(image.rsplit('.', 1)[0]) image_info = database.Image.query.filter_by(id=image).first() if image_info: base62_filename = base62.encode(image_info.id) filename = base62_filename + '.' + image_info.extension full_filename = app.config['UPLOAD_FOLDER'] + '/' + filename return send_from_directory(app.config['UPLOAD_FOLDER'], filename, attachment_filename=base62_filename, as_inline=True, mimetype=image_info.mimetype) return redirect(url_for('index',))