how to display images from folder while displaying image by name using php? -


i have 2 folders, 1)- 23feb2016 , 2)- 23feb2016. want 1 image folder1 , 1 folder2 , image name must unique, userid etc.

this html code:

<div class="col-md-12">     <div class="col-md-6">         <image src="../images/registered/20115.jpg" style="width: 100%; height: 100%"></image> registered     </div>     <div class="col-md-6">         <image src="../images/registered/20115.jpg" style="width: 100%; height: 100%"></image> attendance     </div>  </div> 

same image display in model , submiting send flag db

you can use following approach find unique files.

//path directory scan $directory1 = "./folder1/"; $directory2 = "./folder2/";  //get image files .jpg extension. $jpgfolder1 = glob($directory1 . "*.jpg"); $jpgfolder2 = glob($directory2 . "*.jpg");  $uniqeimage[];  if(($jpgfolder1 != null) && ($jpgfolder2 != null)) {     $uniqeimage = array_unique(array_intersect($jpgfolder1, $jpgfolder2)); } 

now array variable $uniqeimage[] contains unique file names using can construct html

foreach($uniqeimage $img) {     echo("<div class='col-md-12'>");     echo("    <div class='col-md-6'>");     echo("        <image src='../images/folder1/" . $img . ".jpg' style='width: 100%; height: 100%'></image> registered");     echo("    </div>");     echo("    <div class='col-md-6'>");     echo("        <image src='../images/folder2/" . $img . ".jpg' style='width: 100%; height: 100%'></image> attendance");     echo("    </div>");     echo("</div>"); } 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -