1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] display image from SQL database in html flask

Discussão em 'Python' iniciado por Stack, Setembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    I'm stuck on a displaying an image stored in my SQL database. I have stored the image already and want to display it, in a column of a row I have in html. I have managed to display the byte-data by using {{item['img']}} but I'm struggling to get the image to show.

    The code in html is as follows, the div between *** *** is what I need assistance with (I just have a static image there at the moment):

    {% for item in items %}

    <form method="post">
    <div class="card mb-3">
    <div class="card-body">
    <div class="d-flex justify-content-between">
    <div class="d-flex flex-row align-items-center">

    ***<div>
    <img
    src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-shopping-carts/img1.webp"
    class="img-fluid rounded-3" alt="Shopping item" style="width: 65px;">
    </div>***

    <div class="ms-3">
    <h5>{{item["name"]}}</h5>
    </div>
    </div>


    I'm using python flask.the image I attached shows how I want it displayed

    Your assistance is highly appreciated as this is my final project for cs.

    ***<div
    <img
    src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-shopping-carts/img1.webp"
    class="img-fluid rounded-3" alt="Shopping item" style="width: 65px;"
    </div>***

    Continue reading...

Compartilhe esta Página