Load image in modal stored in server

0

Thank you in advance for the help you can give me.

I have an html table which is dynamically filled with data from mysql, in it I have a button that opens a modal window and this modal should show an image previously saved on the server. The problem is that the modal always shows me the same image although for each row of the table it is a different image.

Table Code:

     <table class="table table-striped" id="tabla">
                        <thead>
                            >
                            <th style="width:80px;">Titulo</th>
                            <th style="width:60px;">Editorial</th>
                            <th style="width:60px;">Autor</th>
                            <th style="width:40px;">Grado</th>
                            <th style="width:40px;">Imagen</th>
                        </thead>
                        <tbody>
                            <?php foreach($consultaBiblioteca as $datos): ?>
                            <tr>
                             
                                <td>
                                    <?php echo $datos->getTitulo() ?>
                                </td>
                                <td>
                                    <?php echo $datos->getEditorial() ?>
                                </td>
                                <td>
                                    <?php echo $datos->getAutor() ?>
                                </td>
                                <td>
                                    <?php echo $datos->getGrado() ?>
                                </td>

                                <td>
                                    <button type="button" class="btn btn-primary btn-sm cliente-modal" data-toggle="modal" data-target="#modal_imagen" value="<?php echo $datos->getImagen(); ?>"><span>Imagen</span></button>
                                </td>
                            </tr>
                            <?php 
                        endforeach;
                        ?>
                        </tbody>
                    </table>

Modal

<div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="modal_imagen">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <img src="/upload/<?php echo $datos->getImagen() ?>" alt="" height="auto" class="img-fluid max-width: 100%">
        </div>
    </div>
</div>

I remain attentive to your comments,

    
asked by wico 27.09.2018 в 17:10
source

0 answers