
<?php
   for($x = 0; $x <= count($obj)-1; $x+=3){
?>
   <div class="row contentrow">
       <?php 
         if($page==1 && $x==0)
         {
       ?>
    <div class="col-sm-4 contentdiv" onclick="detailimage('<?php echo str_replace(array("\n", "\r"),"",$obj[$x]);?>','none','<?php echo str_replace(array("\n", "\r"),"",$obj[$x+1]);?>')">
    <?php
         }
         else {
    ?>
    <div class="col-sm-4 contentdiv" onclick="detailimage('<?php echo str_replace(array("\n", "\r"),"",$obj[$x]);?>','<?php echo str_replace(array("\n", "\r"),"",$obj[$x-1]);?>','<?php echo str_replace(array("\n", "\r"),"",$obj[$x+1]);?>')">
    <?php 
         }
    ?>
        <img  src="https://mymakeabl-data.s3.ap-northeast-1.amazonaws.com/<?php echo $obj[$x]  ?>" class="MG">
        <img  src="https://mymakeabl-data.s3.ap-northeast-1.amazonaws.com/<?php echo str_replace(".jpg","_qr.jpg",$obj[$x]);  ?>" class="qrMG">
    </div>
    <?php 
    if($x+1<= count($obj)-1){
    ?>        
        <div class="col-sm-4 contentdiv"  onclick="detailimage('<?php echo str_replace(array("\n", "\r"),"",$obj[$x+1]);?>','<?php echo str_replace(array("\n", "\r"),"",$obj[$x]);?>','<?php echo str_replace(array("\n", "\r"),"",$obj[$x+2]);?>')">
            <img src="https://mymakeabl-data.s3.ap-northeast-1.amazonaws.com/<?php echo $obj[$x+1]  ?>" class="MG">
        <img  src="https://mymakeabl-data.s3.ap-northeast-1.amazonaws.com/<?php echo str_replace(".jpg","_qr.jpg",$obj[$x+1]);  ?>" class="qrMG">
        </div>
    <?php
    }
    if($x+2<= count($obj)-1){
    ?>
        <?php  
          if($page=="last" && $x== count($obj)-1 )
          {
        ?>
        <div class="col-sm-4 contentdiv"  onclick="detailimage('<?php echo str_replace(array("\n", "\r"),"",$obj[$x+2]);?>','<?php echo str_replace(array("\n", "\r"),"",$obj[$x+1]);?>','none')">
        <?php 
          }
          else 
          {
        ?>
        <div class="col-sm-4 contentdiv"  onclick="detailimage('<?php echo str_replace(array("\n", "\r"),"",$obj[$x+2]);?>','<?php echo str_replace(array("\n", "\r"),"",$obj[$x+1]);?>','<?php echo str_replace(array("\n", "\r"),"",$obj[$x+3]);?>')">
        <?php 
          }
        ?>
            <img src="https://mymakeabl-data.s3.ap-northeast-1.amazonaws.com/<?php echo $obj[$x+2]  ?>" class="MG">
            <img  src="https://mymakeabl-data.s3.ap-northeast-1.amazonaws.com/<?php echo str_replace(".jpg","_qr.jpg",$obj[$x+2]);  ?>" class="qrMG">
        </div>
    <?php
    }
?>
    </div>
<?php
    }
?>
 
<?php echo $links; ?>

<form style="visibility: hidden;" id="myForm" name="myform" action="<?php echo base_url();?>AuthController/detailimage" method="POST">
  <input type="text" id="guest" name="guestid"><br>
  <input type="text" id="backguest" name="backguestid"><br>
  <input type="text" id="nextguest" name="nextguestid"><br>
</form>
  <script src="<?php echo base_url();?>assets/js/aws-sdk-2.991.0.min.js"></script>
  <script src="<?php echo base_url();?>assets/js/pagination.js"></script>
  <script>
  setInterval(function(){ window.location.reload(); }, 10000);
   function detailimage(url,back,next)
   {
        document.getElementById("guest").value = url ;
        document.getElementById("backguest").value = back ;
        document.getElementById("nextguest").value = next ;
        document.myform.submit();
   }

  </script>
  <style>
      a{
          width:100px;
          height:100px;
          font-size: 50px;
          margin-left:3px;
          border-radius: 20px;
      }
      strong{
          font-size: 50px;
      }
      
  </style>
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  