Exemple #1
0
def kitten(request, width, height):
    """ Return random image of the given height & width """
    image_id = kittens.get_random_image_id()
    kittens.resize_image(image_id, width, height)
    response = HttpResponseRedirect('%s/images/%s/%sx%s.jpg' % (settings.MEDIA_URL, image_id, width, height))
    response['Cache-Control'] = 'no-cache'
    return response
Exemple #2
0
def kitten(request, width, height):
    """ Return random image of the given height & width """
    image_id = kittens.get_random_image_id()
    kittens.resize_image(image_id, width, height)
    response = HttpResponseRedirect(
        '%s/images/%s/%sx%s.jpg' %
        (settings.MEDIA_URL, image_id, width, height))
    response['Cache-Control'] = 'no-cache'
    return response
Exemple #3
0
def kitten_js(request, width, height):
    """ Return a JS that shows an image of a given h&w along with a link to the flickr page """
    image_id = kittens.get_random_image_id()
    (author_id, picture_id) = image_id.split('-', 1)
    kittens.resize_image(image_id, width, height)
    context = {
        'image_url': '%s/images/%s/%sx%s.jpg' % (settings.MEDIA_URL, image_id, width, height),
        'link': 'http://www.flickr.com/photos/%s/%s/' % (author_id, picture_id),
        'width': width,
        'height': height,
    }
    tpl = get_template('kitten.js')
    html = tpl.render(Context(context))
    response = HttpResponse(html)
    response['Cache-Control'] = 'no-cache'
    return response
Exemple #4
0
def kitten_js(request, width, height):
    """ Return a JS that shows an image of a given h&w along with a link to the flickr page """
    image_id = kittens.get_random_image_id()
    (author_id, picture_id) = image_id.split('-', 1)
    kittens.resize_image(image_id, width, height)
    context = {
        'image_url':
        '%s/images/%s/%sx%s.jpg' %
        (settings.MEDIA_URL, image_id, width, height),
        'link':
        'http://www.flickr.com/photos/%s/%s/' % (author_id, picture_id),
        'width':
        width,
        'height':
        height,
    }
    tpl = get_template('kitten.js')
    html = tpl.render(Context(context))
    response = HttpResponse(html)
    response['Cache-Control'] = 'no-cache'
    return response