Seascapes & Lake

<link href="/sites/all/themes/professional_theme/artist/css/font-awesome/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/sites/all/themes/professional_theme/artist/css/gallery/gallery.css" />
<link rel="stylesheet" type="text/css" href="http://www.anantamandal.com/sites/default/files/styles/gallery-overlay/jquery.fancybox.css" media="screen" />
<script type="text/javascript" src="http://www.anantamandal.com/sites/default/files/styles/gallery-overlay/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="http://www.anantamandal.com/sites/default/files/styles/gallery-overlay/jquery.fancybox.js"></script>
<script type="text/javascript">
        $(document).ready(function() {
            /*
             *  Simple image gallery. Uses default settings
             */

            $('.fancybox').fancybox();

            /*
             *  Different effects
             */

            // Change title type, overlay closing speed
            $(".fancybox-effects-a").fancybox({
                helpers: {
                    title : {
                        type : 'outside'
                    },
                    overlay : {
                        speedOut : 0
                    }
                }
            });

            // Disable opening and closing animations, change title type
            $(".fancybox-effects-b").fancybox({
                openEffect  : 'none',
                closeEffect    : 'none',

                helpers : {
                    title : {
                        type : 'over'
                    }
                }
            });

            // Set custom style, close if clicked, change title type and overlay color
            $(".fancybox-effects-c").fancybox({
                wrapCSS    : 'fancybox-custom',
                closeClick : true,

                openEffect : 'none',

                helpers : {
                    title : {
                        type : 'inside'
                    },
                    overlay : {
                        css : {
                            'background' : 'rgba(238,238,238,0.85)'
                        }
                    }
                }
            });

            // Remove padding, set opening and closing animations, close if clicked and disable overlay
            $(".fancybox-effects-d").fancybox({
                padding: 0,

                openEffect : 'elastic',
                openSpeed  : 150,

                closeEffect : 'elastic',
                closeSpeed  : 150,

                closeClick : true,

                helpers : {
                    overlay : null
                }
            });

            /*
             *  Button helper. Disable animations, hide close button, change title type and content
             */

            $('.fancybox-buttons').fancybox({
                openEffect  : 'none',
                closeEffect : 'none',

                prevEffect : 'none',
                nextEffect : 'none',

                closeBtn  : false,

                helpers : {
                    title : {
                        type : 'inside'
                    },
                    buttons    : {}
                },

                afterLoad : function() {
                    this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
                }
            });


            /*
             *  Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
             */

            $('.fancybox-thumbs').fancybox({
                prevEffect : 'none',
                nextEffect : 'none',

                closeBtn  : false,
                arrows    : false,
                nextClick : true,

                helpers : {
                    thumbs : {
                        width  : 100,
                        height : 100
                    }
                }
            });

            /*
             *  Media helper. Group items, disable animations, hide arrows, enable media and button helpers.
            */
            $('.fancybox-media')
                .attr('rel', 'media-gallery')
                .fancybox({
                    openEffect : 'none',
                    closeEffect : 'none',
                    prevEffect : 'none',
                    nextEffect : 'none',

                    arrows : false,
                    helpers : {
                        media : {},
                        buttons : {}
                    }
                });

            /*
             *  Open manually
             */

            $("#fancybox-manual-a").click(function() {
                $.fancybox.open('1_b.jpg');
            });

            $("#fancybox-manual-b").click(function() {
                $.fancybox.open({
                    href : 'iframe.html',
                    type : 'iframe',
                    padding : 5
                });
            });

            $("#fancybox-manual-c").click(function() {
                $.fancybox.open([
                    {
                        href : '1_b.jpg',
                        title : 'My title'
                    }, {
                        href : '2_b.jpg',
                        title : '2nd title'
                    }, {
                        href : '3_b.jpg'
                    }
                ], {
                    helpers : {
                        thumbs : {
                            width: 75,
                            height: 50
                        }
                    }
                });
            });


        });
</script>


<?php
    mysql_connect("localhost", "wcuser", "$^#341@+2K") or die(mysql_error()); 
    mysql_select_db("arwcan") or die(mysql_error());
?>
<?php
    $tbl_name="field_data_field_gallery_image_category";        //your table name
    // How many adjacent pages should be shown on each side?
    $adjacents = 3;
        
    /* 
       First get total number of rows in data table. 
       If you have a WHERE clause in your query, make sure you mirror it here.
    */
    $query = "SELECT * FROM field_data_field_gallery_image_category WHERE field_gallery_image_category_value='Test'";
    $result = mysql_query($query) or die(mysql_error());
    $count=0;
    while($row = mysql_fetch_array($result)){
                    
           $count=$count+1;
                                            }
    $total_pages = $count;
    
    /* Setup vars for query. */
    $targetpage = "test";     //your file name  (the name of this file)
    $limit = 5;                                 //how many items to show per page
    $page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]);
    if($page) 
        $start = ($page - 1) * $limit;             //first item to display on this page
    else
        $start = 0;                                //if no page var is given, set start to 0
    
    /* Get data. */
    $query_a = "SELECT * FROM field_data_field_gallery_image_category WHERE field_gallery_image_category_value='Test' LIMIT $start, $limit"; 
    $result = mysql_query($query_a) or die(mysql_error());
    
    /* Setup page vars for display. */
    if ($page == 0) $page = 1;                    //if no page var is given, default to 1.
    $prev = $page - 1;                            //previous page is page - 1
    $next = $page + 1;                            //next page is page + 1
    $lastpage = ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.
    $lpm1 = $lastpage - 1;                        //last page minus 1
    
    /* 
        Now we apply our rules and draw the pagination object. 
        We're actually saving the code to a variable in case we want to draw it more than once.
    */
    $pagination = "";
    if($lastpage > 1)
    {    
        $pagination .= "<div class=\"pagination\">";
        //previous button
        if ($page > 1) 
            $pagination.= "<a href=\"$targetpage?page=$prev\"><< previous</a>";
        else
            $pagination.= "<span class=\"disabled\"><< previous</span>";    
        
        //pages    
        if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up
        {    
            for ($counter = 1; $counter <= $lastpage; $counter++)
            {
                if ($counter == $page)
                    $pagination.= "<span class=\"current\">$counter</span>";
                else
                    $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                    
            }
        }
        elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some
        {
            //close to beginning; only hide later pages
            if($page < 1 + ($adjacents * 2))        
            {
                for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
                {
                    if ($counter == $page)
                        $pagination.= "<span class=\"current\">$counter</span>";
                    else
                        $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                    
                }
                $pagination.= "...";
                $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
                $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";        
            }
            //in middle; hide some front and some back
            elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
            {
                $pagination.= "<a href=\"$targetpage?page=1\">1</a>";
                $pagination.= "<a href=\"$targetpage?page=2\">2</a>";
                $pagination.= "...";
                for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
                {
                    if ($counter == $page)
                        $pagination.= "<span class=\"current\">$counter</span>";
                    else
                        $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                    
                }
                $pagination.= "...";
                $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
                $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";        
            }
            //close to end; only hide early pages
            else
            {
                $pagination.= "<a href=\"$targetpage?page=1\">1</a>";
                $pagination.= "<a href=\"$targetpage?page=2\">2</a>";
                $pagination.= "...";
                for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
                {
                    if ($counter == $page)
                        $pagination.= "<span class=\"current\">$counter</span>";
                    else
                        $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                    
                }
            }
        }
        
        //next button
        if ($page < $counter - 1) 
            $pagination.= "<a href=\"$targetpage?page=$next\">next >></a>";
        else
            $pagination.= "<span class=\"disabled\">next >></span>";
        $pagination.= "</div>\n";        
    }
?>
<div id="grid-gallery" class="grid-gallery">
  <section class="grid-wrap">
    <ul class="grid">
      <?php
        $query_a = "SELECT * FROM field_data_field_gallery_image_category WHERE field_gallery_image_category_value='Test' LIMIT $start, $limit"; 
        $result1 = mysql_query($query_a) or die(mysql_error());
        while($row1 = mysql_fetch_array($result1)){
        $pid = $row1['entity_id'];
        $title = db_query("SELECT field_gallery_image_title FROM field_data_field_gallery_image WHERE entity_id='$pid ';")->fetchField();
        $size = db_query("SELECT field_size_value FROM field_data_field_size WHERE entity_id='$pid ';")->fetchField();
        $price = db_query("SELECT field_gallery_imageprice_value FROM field_data_field_gallery_imageprice WHERE entity_id='$pid ';")->fetchField();
        $status = db_query("SELECT field_status_value FROM field_data_field_status WHERE entity_id='$pid ';")->fetchField();
        $shipping = db_query("SELECT field_shipping_value FROM field_data_field_shipping WHERE entity_id='$pid ';")->fetchField();
        $node = node_load($pid);
        //$file1 = file_load($node->field_gallery_image['und'][0]['fid']);
        $file1 = file_load($node->field_gallery_thumb_image['und'][0]['fid']);
    ?>
      <li style="margin:0 auto; float:left; width:25%; padding:1%;">
        <figure>
          <figcaption>
            <h3><?php echo $title ;?></h3>
          </figcaption>
          <img src="<?php echo file_create_url($file1->uri);?>" style="width:100%; padding:2%; border:1px solid #c8cac7;" /> </figure>
      </li>
      <?php } ?>
    </ul>
  </section>
  <!-- // grid-wrap -->
  <section class="slideshow">
    <ul>
      <?php
        $query_b = "SELECT * FROM field_data_field_gallery_image_category WHERE field_gallery_image_category_value='Test' LIMIT $start, $limit"; 
        $result2 = mysql_query($query_b) or die(mysql_error());    
        while($row2 = mysql_fetch_array($result2)){
        $pid = $row2['entity_id'];
        $title = db_query("SELECT field_gallery_image_title FROM field_data_field_gallery_image WHERE entity_id='$pid ';")->fetchField();
        $size = db_query("SELECT field_size_value FROM field_data_field_size WHERE entity_id='$pid ';")->fetchField();
        $price = db_query("SELECT field_gallery_imageprice_value FROM field_data_field_gallery_imageprice WHERE entity_id='$pid ';")->fetchField();
        $status = db_query("SELECT field_status_value FROM field_data_field_status WHERE entity_id='$pid ';")->fetchField();
        $shipping = db_query("SELECT field_shipping_value FROM field_data_field_shipping WHERE entity_id='$pid ';")->fetchField();
        $node = node_load($pid);
        $file2 = file_load($node->field_gallery_image['und'][0]['fid']);
        //$file4 = file_load($node->field_gallery_thumb_image['und'][0]['fid']);
    ?>
      <li>
        <figure>
          <h3><?php echo $title ;?></h3>
          <div id="fullscreen" class="html5-fullscreen-api"> <img src="<?php echo file_create_url($file2->uri);?>" />
            <?php /*?><div class="fs-button"><span class="expend1"><i class="fa fa-expand"></i></span></div><?php */?>
          </div>
          <figcaption>
            <p>Acrylic on Canvas <?php echo $size ;?> | Status: <span style="color:#18bc0e;"><?php echo $status ;?></span> | Price: <?php echo $price ;?> | Shipping: <?php echo $shipping ;?></p>
          </figcaption>
        </figure>
      </li>
      <?php } ?>
    </ul>
    <nav> <span class="nav-prev"><i class="fa fa-angle-left" style="font-size:70px; font-weight:bold;"></i></span> <span class="nav-next"><i class="fa fa-angle-right" style="font-size:70px; font-weight:bold;"></i></span> <span class="nav-close"><i class="fa fa-times"></i></span> </nav>
  </section>
  <!-- // slideshow --> 
</div>
<!-- // grid-gallery -->

<?=$pagination?>
<!-- Modernizr javascript --> 
<script type="text/javascript" src="/sites/all/themes/professional_theme/artist/js/jquery.min.js"></script> 
<script type="text/javascript" src="/sites/all/themes/professional_theme/artist/js/gallery/modernizr.custom.js"></script> 

<!-- Gallery --> 
<script src="/sites/all/themes/professional_theme/artist/js/gallery/gallery.min.js"></script> 
<script src="/sites/all/themes/professional_theme/artist/js/gallery/gallery.js"></script> 
<script>
    new CBPGridGallery( document.getElementById( 'grid-gallery' ) );
</script> 
<!---- Full Screen ----->