    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
    <!--data table--> 
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/pdfmake-0.1.18/dt-1.10.12/b-1.2.2/b-colvis-1.2.2/b-html5-1.2.2/b-print-1.2.2/r-2.1.0/datatables.min.css" /> 
    <script type="text/javascript" src="https://cdn.datatables.net/v/bs/pdfmake-0.1.18/dt-1.10.12/b-1.2.2/b-colvis-1.2.2/b-html5-1.2.2/b-print-1.2.2/r-2.1.0/datatables.min.js"></script> 
<div class="content-wrapper">

<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Add Custom Images</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active">IMAGES</li>
</ol>
</div>
</div>
</div>
</section>
  <?php
            $success = $this->session->flashdata('success');
            if(isset($success)){  ?>
                <div class="alert alert-success">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <?php echo $this->session->flashdata('success');?>
                </div>
            <?php } ?>
            <?php
            $error = $this->session->flashdata('error');
            if(isset($error)){  ?>
                <div class="alert alert-danger">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <?php echo $this->session->flashdata('error');?>
                </div>
            <?php } ?>
            
<section class="content">
<div class="container-fluid">
    <?php
$si = $this->uri->segment(2);
echo $ss = $this->uri->segment(3);
if($si == 'Add_image' AND $ss != 'view'){
?>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Add Images</h3>
</div>

<div class="card-body">
<form action="<?php echo base_url('admin/Add_image/add');?>" method="post"
                              enctype="multipart/form-data">
                            <div class="form-group">
                                <label for="">Add Images (Max 50 Images one Time)</label>
                                <input type="file" name="img[]" multiple max="50" class="form-control" accept="image/*">
                            </div>
                            <div class="form-group">
                                <input type="submit" name="btn" class="btn btn-primary" value="Add Multipal Images">
                            </div>
                        </form>
</div>

</div>
<?php }elseif($si == 'Add_image' AND $ss == 'view'){?>
<div class="card">
<div class="card-header">
<h3 class="card-title">ALL IMAGES</h3>
</div>

<div class="card-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
                    <th>NO</th>
                    <th>URL</th>
                    <th>Image</th>

                    <th>Actions</th>
                </tr>
</thead>
<tbody>
 <?php
                $counter = 1;
                foreach ($tic as $tok) { ?>
                    <tr>
                        <td><?php echo $counter ; ?></td>
                        <td><a href="<?php echo base_url('uploads/allimages/').$tok->name;?>" target="_parent"><?php
                                echo base_url('uploads/allimages/').$tok->name; ?></a></td>
                        <td><img src="<?php echo base_url('uploads/allimages/thumbs/').$tok->name;?>" alt=""
                                 style="width: 120px;"></td>


                        <td>
                            <a href="<?php echo base_url('admin/Add_image/delete/'.$tok->id);?>" class="btn
                            btn-danger">Delete</a>
                        </td>
                    </tr>
                    <?php
                    $counter++;
                } ?>
</tfoot>
</table>
</div>

</div>
 <?php }?>
</div>

</div>

</div>

</section>

</div>
<script>
  $(function () {
    $("#example1").DataTable({
      "responsive": true, "lengthChange": false, "autoWidth": false,
      "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
    $('#example2').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,
    });
  });
</script>