Ejemplo n.º 1
0
def placeholder(width, height=None, bgd="cccccc", fgd="909090"):
    """
    This endpoint generates the placeholder itself, based on arguments.
    If the height is missing, just make the image square.
    """
    if height is None:
        height = width
    # get optional caption
    txt = request.args.get('text', None)
    # lobster for the shitty designers
    lobster = request.args.get('lobster', None)
    # processing image
    im = pil_image(width, height, bgd, fgd, txt, lobster)
    return serve_pil_image(im)
Ejemplo n.º 2
0
def placeholder(width, height=None, bgd="cccccc", fgd="909090"):
    """This endpoint generates the placeholder itself, based on arguments.
    If the height is missing, just make the image square.
    """
    if not height:
        height = width
    # get optional caption, default is width X height
    # fakeimg.pl/400x400/?text=whosmad
    txt = request.args.get('text', "{0} x {1}".format(width, height))
    # grab the font, default is yanone
    # fakeimg.pl/400x400/?font=lobster
    font = request.args.get('font', 'yanone')
    # processing image
    im = pil_image(width, height, bgd, fgd, txt, font)
    return serve_pil_image(im)
Ejemplo n.º 3
0
def placeholder(width, height=None, bgd="cccccc", fgd="909090"):
    """This endpoint generates the placeholder itself, based on arguments.
    If the height is missing, just make the image square.
    """
    if not height:
        height = width
    # get optional caption, default is width X height
    # fakeimg.pl/400x400/?text=whosmad
    txt = request.args.get('text', "{0} x {1}".format(width, height))
    # grab the font, default is yanone
    # fakeimg.pl/400x400/?font=lobster
    font = request.args.get('font', 'yanone')
    # processing image
    im = pil_image(width, height, bgd, fgd, txt, font)
    return serve_pil_image(im)
Ejemplo n.º 4
0
def placeholder(width, height=None, bgd="cccccc", fgd="909090"):
    """This endpoint generates the placeholder itself, based on arguments.
    If the height is missing, just make the image square.
    """
    height = height or width
    # get optional caption, default is width X height
    # fakeimg.pl/400x400/?text=whosmad
    txt = request.args.get("text", "{0} x {1}".format(width, height))
    # grab the font, default is yanone
    # fakeimg.pl/400x400/?font=lobster
    font = request.args.get("font", "yanone")
    # retina mode, just make the image twice bigger
    if request.args.get("retina"):
        width, height = [x * 2 for x in [width, height]]
    # processing image
    im = pil_image(width, height, bgd, fgd, txt, font)
    return serve_pil_image(im)
Ejemplo n.º 5
0
def placeholder(width, height=None, bgd="cccccc", fgd="909090"):
    """
    This endpoint generates the placeholder itself, based on arguments.
    If the height is missing, just make the image square.
    """
    stathat_key = os.environ.get('STATHAT_KEY', None)
    if stathat_key:
        # Stathat: count the image generated
        stathat = StatHat()
        stathat.ez_post_count(stathat_key, 'Fakeimg generated', 1)

    if height is None:
        height = width
    # get optional caption
    txt = request.args.get('text', None)
    # lobster for the shitty designers
    # fakeimg.pl/400x400/?font=lobster
    font = request.args.get('font', None)
    # processing image
    im = pil_image(width, height, bgd, fgd, txt, font)
    return serve_pil_image(im)
Ejemplo n.º 6
0
def placeholder(width, height=None, bgd="cccccc", fgd="909090"):
    """
    This endpoint generates the placeholder itself, based on arguments.
    If the height is missing, just make the image square.
    """
    stathat_key = os.environ.get('STATHAT_KEY', None)
    if stathat_key:
        # Stathat: count the image generated
        stathat = StatHat()
        stathat.ez_post_count(stathat_key, 'Fakeimg generated', 1)

    if height is None:
        height = width
    # get optional caption
    txt = request.args.get('text', None)
    # lobster for the shitty designers
    # fakeimg.pl/400x400/?font=lobster
    font = request.args.get('font', None)
    # processing image
    im = pil_image(width, height, bgd, fgd, txt, font)
    return serve_pil_image(im)