File: /var/www/content-sp/uploads/image_trace.php
<?php
error_reporting(0);
error_reporting(E_ALL);
ini_set('display_errors', 'On');
ini_set('max_execution_time', 0); //0=NOLIMIT
$type = 'png';
$dirname = "../uploads/tet_admin_photos_sp/";
$images = glob($dirname . "*." . $type);
echo sizeof($images);
$record_count = 500;
$totla_pages = ceil(count($images)/$record_count);
$page = isset($_GET['pageN']) ? $_GET['pageN'] : 1;
$indexN = ($page - 1) * $record_count;
$offset = ($page-1)*$record_count;
$files_filter = array_slice($images, $offset,$record_count);
?>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td,
th {
border: 1px solid #dddddd;
text-align: left;
padding: 5px;
}
</style>
<table>
<tr>
<th>S.No.</th>
<th>Image</th>
<th>Image Name</th>
</tr>
<?php
$i = 1;
foreach ($files_filter as $image) {
$imageName = substr($image, 25);
?>
<tr>
<td><?php echo $i+$indexN; ?></td>
<td><?php echo '<img width="100" height="50" src="' . $image . '" />'; ?></td>
<td><?php echo $image; ?></td>
</tr>
<?php $i++;
}
if($totla_pages > 1){
if($page != 1){
echo '<a href="image_trace.php?pageN='.($page-1).'">Prev</a>';
}
if($page != $totla_pages){
echo '<a href="image_trace.php?pageN='.($page+1).'">Next</a>';
}
}
?>
</table>