<div id="mainPage">
<div class="row">
    <div class="col-md-8" id="page">
        <div class="row finali">


            @foreach($model as $row)
            
            <div class="col-md-3">
                <?php 
                    list($width, $height, $type, $attr) = getimagesize(public_path(Config("params.media_path.large"))."".$row->file); 
                    if($row->type!='svg'){
                        list($width2, $height2, $type2, $attr2) = getimagesize(public_path(Config("params.media_path.thumbnail"))."".$row->file); 
                    }

                    ?>
                <img  class="selectFile"
                   
                      data-category="<?php if(!empty($row->category)){echo $row->category; }else{ echo'No category';}?>"
                      data-url="{{$row->file}}"
                      
                      <?php  if($row->type!='svg'){?>
                      data-thumbnails="{{$width2}} x {{$height2}}"
                      <?php  }?>
                      data-description="<?php if(!empty($row->description)){echo $row->description; }else{ echo'No description';}?>"
                      data-filename="<?php if(!empty($row->fileName)){echo $row->fileName; }else{ echo'No fileName';}?>" 
                      data-type="<?php if(!empty($row->type)){echo $row->type; }else{ echo'No type';}?>" 
                      data-dimensions="{{$width}} x {{$height}}" 
                      data-title="<?php if(!empty($row->title)){echo $row->title; }else{ echo'No Title';}?>"  
                      data-id="{{$row->id}}" 
                      data-file="{{$row->file}}" 
                       <?php  if($row->type=='svg'){?>
                            src="{{asset("/uploads/$folder")."/".$row->file}}"  alt="{{$row->file}}" width="150px" height="150px" >
                        <?php  }else {?>
                            src="{{asset("/uploads/$folder/thumbnails")."/".$row->file}}" alt="{{$row->file}}" width="150px" height="150px" >
                        <?php  }?>
                      <span class="kt-header__topbar-welcome" style="display: none; word-break: break-word;">021/03/ddfa80c65238f8b96dfee0ad4e3487be1616865738.jpg</span>
            </div>
            @endforeach

        </div>
        <div class="row">
            <div class="col-md-12">

                {!! $model->appends(Request::all())->links();!!}

            </div>
        </div>

    </div>
    <div class="col-md-4" id="menu3" style="display:none;">
        <div class="right-side">
            <div class="right-side-img">
                <img class="selectFile" src="" id="selectedimage">
            </div>
            <div class="url-bar">
                <label>URL :</label>
                <input class="url-input" type="text" value="" id="imageurl">
            </div>
            <div id="imageDetail">
                <ul>
                    <li id="title"></li>
                    <li id="fileName"></li>
                    <li id="type"></li>
                    <li id="category"></li>
                    <li id="dimensions"></li>
                    <li id="url"></li>
                    <li id="thumbnailsDimensions"></li>
                    <li id="thumbnailsurl"></li>
                </ul>
            </div>
        </div>
    </div>
</div>
</div>
<script>
    $(document).ready(function () {

        $(document).on('click', '.pagination a', function (event) {
            event.preventDefault();
            var page = $(this).attr('href');
           // alert(page);
            fetch_data(page);
        });

        function fetch_data(page)
        {
            $.ajax({
                url: page,
                success: function (data)
                {
                    $('#mainPage').html(data);
                }
            });
        }

    });
</script>