vishwamano

source of vishwamano.com
git clone git://git.ricketyspace.net/vishwamano.git
Log | Files | Refs

commit f93dd1e1251a6e70f31e5771c513f2b99da4b3b5
parent 0d144c58a9818ee91db9527105bf304366b8fec4
Author: rsiddharth <s@ricketyspace.net>
Date:   Mon, 12 Nov 2018 20:13:10 -0500

gallery: Update landscapes/index.php.

Don't use smarty.

* gallery/landscapes/index.php: Update file.
* parts/gallery-genre.php: New file.

Diffstat:
gallery/landscapes/index.php | 51++++++++++++++-------------------------------------
parts/gallery-genre.php | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 99 insertions(+), 37 deletions(-)

diff --git a/gallery/landscapes/index.php b/gallery/landscapes/index.php @@ -1,44 +1,22 @@ <?php -/* Vishwamano.com PHP snafu. +/** + * License: CC0-1.0 + */ - Copyright (C) 2014 rsiddharth <rsiddharth@ninthfloor.org> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - COPYING contains the full text of the GNU Affero General Public - License. If you have not recieved a copy of the file along with - this program, see <http://www.gnu.org/licenses/>. - -*/ - - -require_once('../../templating.php'); -require_once($abs_path . '/utils.php'); +require_once('../../init.php'); $title = 'Landscapes &middot; Gallery &middot; Vishwa Mano Photography'; -$meta_keywords = 'Vishwa, Mano, Manoharan, Photography, Chennai, Gallery, Landscapes, Animals, Birds, Insects, Flowers, Macro, Wildlife, Nature, Reptiles'; +$meta_keywords = 'Vishwa, Mano, Manoharan, Photography, Chennai, Gallery,' + . ' Landscapes, Animals, Birds, Insects, Flowers, Macro,' + . ' Wildlife, Nature, Reptiles'; $meta_desc = 'Nature\'s paintings through Vishwa\'s perspective.'; +$gallery_name = 'landscapes'; +$images = get_images('../../images/gallery/' . $gallery_name . '/'); +$images_root = '/images/gallery/landscapes'; -$gallery_info = array('name' => 'landscapes', - 'imgs_path' => $abs_path . '/images/gallery/landscapes/', - 'imgs_root' => '/images/gallery/landscapes', - 'parent' => '/gallery/'); -$images = get_images($gallery_info['imgs_path']); - -$smarty->assign('no_of_images', count($images)); -$smarty->assign('gallery_info', $gallery_info); -$smarty->assign('images', $images); -$smarty->assign('title', $title); -$smarty->assign('meta_keywords', $meta_keywords); -$smarty->assign('meta_description', $meta_desc); -$smarty->display('gallery-genre.tpl');- \ No newline at end of file +require(PARTS . 'header.php'); +require(PARTS . 'gallery-genre.php'); +require(PARTS . 'aside.php'); +require(PARTS . 'footer.php'); diff --git a/parts/gallery-genre.php b/parts/gallery-genre.php @@ -0,0 +1,85 @@ +<div class="container-fluid"> <!-- top container start --> + + <div class="row"> <!-- loading img start --> + <div class="col-sm-12"> + <img id="vm-loading-img" class="img-responsive loading-vm" + src="/themes/bs3/img/loading-vm.gif" + alt="[ Loading... ]"> + </div> + </div> <!-- loading img end --> + + <!-- photoset row start --> + <div class="row"> + <div class="col-sm-12"> + + <!-- photoset grid start --> + <div class="photoset-grid-custom" style="visibility: hidden;"> + <?php foreach($images as $i => $img) { ?> + <img class="img-responsive" src="<?=$images_root?>/<?=$img?>" + alt="[ <?=$gallery_name?> - <?=$img?> ]"/> + <?php } ?> + </div> + <!-- photoset grid end --> + + </div> + </div> + <!-- photoset row end --> + +</div> +<!-- top container end --> + +<script> + $(document).ready(setupPhotoGrid); + + function setupPhotoGrid() { + var layout_spec = ''; + var screenWidth = $(window).width(); + var no_images = <?=count($images)?>; + + var l = []; + var li; // index for array `l'. + var layout_array = []; + var i = 0; // index for array `layout_array'. + + if(screenWidth <= 736) { + l = [1, 2]; + } + else { + l = [3, 3]; + } + + var sum = 0; + var iter = 0; + while(sum != no_images) { + li = iter++ % 2; + if(sum + l[li] > no_images) + continue; + + sum += l[li]; + layout_array[i++] = l[li]; + } + + for(i = 0; i < layout_array.length; i++) { + layout_spec += layout_array[i]; + } + + $('.photoset-grid-custom').photosetGrid({ + highresLinks: true, + gutter: '5px', + layout: layout_spec, + rel: 'category', + onInit: function(){}, + onComplete: function(){ + $('img').remove('#vm-loading-img'); + $('.photoset-grid-custom').attr('style', ''); + $('.photoset-grid-custom a').colorbox({ + photo: true, + scalePhotos: true, + maxHeight:'90%', + maxWidth:'90%' + }); + } + }); + } +</script> +