Exemple #1
0
def index(ir=None):
    ir = parse_request(ir)
    app.logger.debug(ir)
    cache = Cache(ir)
    cache_file = cache.serve()
    if cache_file:
        return draw_image(cache_file, ir)

    if not ir or ('error' in ir and ir['error']):
        return handle_error(ir)

    if os.path.exists(ir['override_photo_path']):
        app.logger.info('Loading Company Override Photo')
        ir['draw_file'] = ir['override_photo_path']
    elif os.path.exists(ir['mls_photo_path']):
        app.logger.info('Loading MLS Photo')
        ir['draw_file'] = ir['mls_photo_path']
    else:
        app.logger.warning('Cannot Find file')
        ir['error'] = 'Unknown_File'
        return handle_error(ir)
    if 'image_adj' in ir and ir['image_adj']:
        img_obj = Manipulations().go(ir['draw_file'], ir)
        maniup_file = cache.save(img_obj)
        ir['draw_file'] = maniup_file
    return Draw(ir).image()
Exemple #2
0
def index(ir=None):
    ir = parse_request(ir)
    cache = Cache(ir)
    cache_file = cache.serve()
    if cache_file:
        return draw_image(cache_file, ir)

    if not ir or ('error' in ir and ir['error']):
        return handle_error(ir)
    app.logger.debug(ir['realtor_file_id'])
    if os.path.exists(ir['realtor_file_id']):
        app.logger.info('Loading Realtor Photo')
        image_phile = ir['realtor_file_id']
    else:
        app.logger.warning('Cannot Find Realtor File')
        ir['error'] = 'Unknown_File'
        return handle_error(ir)
    if 'image_adj' in ir and ir['image_adj']:
        img_obj = Manipulations().go(image_phile, ir)
        image_phile = cache.save(img_obj)
        app.logger.debug(img_obj)
    return Draw.image(str(image_phile), ir)