-1

Through form data i'm able to upload the image to azure blob storage through backend. How can i get real time image from expo camera and upload the same to azure blob storage.

enter image description here

Backend code- flask python

@app.route('/api/addincident', methods=['POST'])
def upload_file():  # to upload image
    file = request.files['file']
    damage_type = request.form.get('damage_type')
    damage_parts = request.form.get('damage_parts')
    location_address = request.form.get('location_address')
    geolocation_latitude = request.form.get('geolocation_latitude')
    geolocation_longitude = request.form.get('geolocation_latitude')
    datetime = request.form.get('datetime')
    created_by = request.form.get('created_by')
    created_on = request.form.get('created_on')
    modified_by = request.form.get('modified_by')
    modified_on = request.form.get('modified_on')
    customer_id = request.form.get('customer_id')

    filename = secure_filename(file.filename)
    fileextension = filename.rsplit('.', 1)[1]
    Randomfilename = id_generator()
    filename = Randomfilename + '.' + fileextension
    try:
        blob_service.create_blob_from_stream(container, filename, file)
    except Exception:
        print('Exception=' + Exception)
        pass
    image_filepath = 'http://' + account + '.blob.core.windows.net/' + container + '/' + filename

    connection = database
    cursor = connection.cursor()

    postgres_insert_query = """INSERT INTO incidentreport(damage_type, damage_parts, location_address, 
                        geolocation_latitude, geolocation_longitude, datetime, image_filepath, created_by, created_on, modified_by, 
                        modified_on, customer_id)VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) """

    cursor.execute(postgres_insert_query, (
        damage_type, damage_parts, location_address, geolocation_latitude, geolocation_longitude, datetime,
        image_filepath, created_by, created_on, modified_by, modified_on, customer_id))

    connection.commit()

    return image_filepath
0

1 Answer 1

0

You can try to use camera control through Power Apps and upload the images to Azure Blob Storage. There is a property called Stream (Use the Stream, StreamRate, and OnStream properties to automatically capture images on a timer, for example snapping a picture every minute to create a time-lapse sequence.) on the Camera control

How to upload images from the camera control to Azure blob storage

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.