Example #1
0
def get(id):
    try:
        doc = imagedb.get(id)
    except imagedb.NoDocument:
        abort(404)
    if not 'type' in doc:
        abort(404)
    if imagedb.isHidden(id) and not 'username' in session:
        abort(403)
    if doc['type'] == 'image':
        return render_template('image.html', doc=doc, getTag=imagedb.getTag, sorted=sorted, username=session['username'] if 'username' in session else None)
    if doc['type'] == 'tag':
        return render_template('tag.html', doc=doc)
    if doc['type'] == 'link' and doc['linktype'] == 'simmilar':
        return render_template('simmilar.html', doc=doc)
    abort(404)
Example #2
0
def showThumb(image):
    if not 'username' in session and imagedb.isHidden(image):
        abort(403)
    return Response(imagedb.getImage(image, type='thumb'), mimetype=config.thumbMime)
Example #3
0
def showImage(image):
    if not 'username' in session and imagedb.isHidden(image):
        abort(403)
    i = imagedb.getImage(image, type='image')
    return Response(i[0].read(), mimetype=i[1])