How can I put images side by side dynamicly?

I wanna make a image processing app. And my base code is like this:

import datetime
import pandas as pd
import numpy as np
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import cv2
from PIL import Image, ImageTk
import base64, rawpy
from io import BytesIO
from matplotlib import pyplot as plt
import as px

external_stylesheets = ['']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div([
            'Drag and Drop or ',
            html.A('Select Files')
            'width': '100%',
            'height': '60px',
            'lineHeight': '60px',
            'borderWidth': '1px',
            'borderStyle': 'dashed',
            'borderRadius': '5px',
            'textAlign': 'center',
            'margin': '10px'
    html.Div(id='output-image-upload', style={'height':'5%', 'width':'5%'}), html.Hr()

def parse_contents(contents, filename, date):

    return html.Div([

@app.callback(Output('output-image-upload', 'children'), 
              Input('upload-image', 'contents'),
              State('upload-image', 'filename'),
              State('upload-image', 'last_modified'))
def update_output(list_of_contents, list_of_names, list_of_dates):
    f_contents = []
    if list_of_contents is not None:
        children = [
            parse_contents(c, n, d) for c, n, d in
            zip(list_of_contents, list_of_names, list_of_dates)

    return children

if __name__ == '__main__':
    app.run_server(debug=False, port=1010)

AFter I run the app, I choose some images from my local machine. (4 or 6 images). And photos are in down order. But I wanna show them side by side.

Currently they are like left one, but i wanna show them like right one.

What can you advice me?

I cant say any number about photos. Dynamicly maybe I can choose 4 maybe 6 maybe 2.

Hi @bilallozdemir

I think you can do that if put every image in a html.Div that has the following style:

    style= {'display':'inline-block', 'float':'left'}

You can do it dynamically or adding the css in a css file.

actually i tried it now, and it is not working well :confused:


did you try this?:

    return html.Div([
    ], style= {'display':'inline-block', 'float':'left'})