Viewing images in the database with a separate cakephp file

0

I'm using phpcake as an administrator of a photo gallery, the images are saved inside the webroot / img / galleries folder / for each category a folder is created following a numbering. Until then everything is working.

The problem is when I will list the images in a file outside phpcake just using pure php, I use the following code to call the images

<?php
    $photos = $conexao->query("SELECT * FROM images WHERE galeria_id = $album_id");
        while($photo_data = $photos->fetch_assoc()) { ?>
        <div class="col-lg-4">
<img class="img-responsive" src=admin/webroot/img/galerias/"<?php echo $photo_data['galeria_id'] ?><?php echo $photo_data['image'] ?>" />
        </div>
    <?php }
    ?>

After that it returns me an error in the Chrome 403 console (Forbidden) o in the path of the photo it adds %222bb1d11f-ea8a-4a27-b6f8-f28b1e5098ea.jpg%22 these %222 at the beginning and end of the image. I just wanted to put the id that is the same as the folder number and then the path that is saved in the image.

    
asked by anonymous 30.08.2017 / 01:11

1 answer

0

Place the double quotation marks at the beginning of the image path:

src="admin/webroot/img/galerias/'<?php echo $photo_data['galeria_id'] ?><?php echo $photo_data['image']' ?>"

And make sure this is the same as the image's address, as I'm pretty sure there's a missing (/) between the php tags, and I'm pretty sure it's missing or something at the beginning of the path ...

    
08.09.2017 / 17:24