简体   繁体   中英

How to get images from folder with php (Codeigniter)

so I recently try to make gallery on my website project. I succeed to display it like this with PHP. (I get all the images inside my gallery folder).

<section id="portfolio">
    <div class="container">
        <div class="row">
          <?php
            $dirname = "./assets/images/gallery/";
            $images = glob($dirname."*.jpg");

            foreach($images as $image) {
              echo //'<img src="'.$image.'" /><br />';

        "<div class='col-xs-6 col-sm-4 col-md-3 portfolio-item branded folio'>
            <div class='portfolio-wrapper'>
                <div class='portfolio-single'>
                    <div class='portfolio-thumb'>
                    <img src='.$image.' class='img-responsive' alt=''>
                    </div>
                    <div class='portfolio-view'>
                        <ul class='nav nav-pills'>
                            <li><a href='gallerydetail'><i class='fa fa-link'></i></a></li>
                            <li><a href='assets/images/portfolio/2.jpg' data-lightbox='example-set'><i class='fa fa-eye'></i></a></li>
                        </ul>
                    </div>
                </div>
                <div class='portfolio-info'>
                    <h2>Sailing Vivamus</h2>
                </div>
            </div>
        </div>";
     }
   ?>

The problems are, I'm using 'modal' to display this images, I really don't know how to work on this part.

<li><a href='assets/images/portfolio/2.jpg' data-lightbox='example-set'><i class='fa fa-eye'></i></a></li>

What should I do, in order to display the same images on the screen part + inside the modals.

Forget it.. This is how I solved it. Silly me XDXDXD But thanks for watching. I hope this will be an answer for someone who need it later

<li><a href='.$image.' data-lightbox='example-set'><i class='fa fa-eye'></i></a></li>
use a plugin for view 

like jequery light box
fancy box
and pretty photo
check this

Pretty photo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM