Ejemplo n.º 1
0
def init_image(img_form, job_id):
    """
    Will save the image to the FS and prepares the image objects to be save in the db
    :param img_form: Form data for one image
    :return: Image object
    """
    try:
        images.save(img_form['img_upload'], job_id + "/img")
        image = Image()
        image.img_upload = img_form['img_upload'].filename
        image.duration = img_form['duration']
        image.slide_type = img_form['slide_type']

    except UploadNotAllowed:
        return None

    return image