Browse Source

Got image gallery working for a single event.

pull/77/head
Jeffery Russell 5 years ago
parent
commit
e0898c742e
15 changed files with 54 additions and 10 deletions
  1. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02107.jpg
  2. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02145.jpg
  3. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02154.jpg
  4. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02168.jpg
  5. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02203.jpg
  6. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02207.jpg
  7. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02221.jpg
  8. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02237.jpg
  9. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02282.jpg
  10. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02288.jpg
  11. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02296.jpg
  12. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02317.jpg
  13. +27
    -2
      routes/photos/index.js
  14. +26
    -8
      templates/photos/photosEntry.html
  15. +1
    -0
      utils/pageBuilder.js

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02107.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 71 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02145.jpg View File

Before After
Width: 200  |  Height: 129  |  Size: 72 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02154.jpg View File

Before After
Width: 200  |  Height: 108  |  Size: 68 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02168.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 72 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02203.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 64 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02207.jpg View File

Before After
Width: 200  |  Height: 172  |  Size: 69 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02221.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 64 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02237.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 66 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02282.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 67 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02288.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 76 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02296.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 66 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02317.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 68 KiB

+ 27
- 2
routes/photos/index.js View File

@ -8,16 +8,41 @@ const whiskers = require('whiskers');
const url = require('url'); const url = require('url');
const fs = require('fs');
routes.get('/', (request, result) => routes.get('/', (request, result) =>
{ {
//do something later //do something later
console.log("boo");
}); });
const photosBaseDir = "blogContent/photos";
photoPageBuilder = function(filename, request, templateContext)
{
if(fs.existsSync(photosBaseDir + filename))
{
templateContext.images = [];
var imagePath = "/" + photosBaseDir + filename + "/";
fs.readdirSync(photosBaseDir + filename).forEach(file=>
{
if(file.includes('.jpg')) //doesn't pick up mark down files
{
templateContext.images.push({full:imagePath+ file,
preview:imagePath + "preview/" + file});
}
});
}
else
{
templateContext.error = true;
}
};
routes.get('*', (request, result) => routes.get('*', (request, result) =>
{ {
pageBuilder.buildPageWithTemplate(request, result, pageBuilder.buildPageWithTemplate(request, result,
function(){}, "photos/photosEntry.html");
photoPageBuilder, "photos/photosEntry.html");
}); });
module.exports = routes; module.exports = routes;

+ 26
- 8
templates/photos/photosEntry.html View File

@ -5,14 +5,32 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/1.6.12/css/lightgallery.min.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/1.6.12/css/lightgallery.min.css" />
<div class="container"> <div class="container">
<div id="lightgallery">
<a href="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg">
<img src="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg" />
</a>
<a href="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg">
<img src="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg" />
</a>
<br><br><br><br>
<div id="lightgallery" class="row p-4">
{for img in images}
<div class="col-lg-3 col-md-4 col-xs-6 thumb p-1" data-src='{img.full}'>
<a href="{img.full}">
<img src="{img.preview}" />
</a>
</div>
{/for}
{if error}
<div class="row p-lg-0">
<h1 class="align-content-center">Page Not Found</h1>
<div class="align-content-center">
<img src="/includes/img/404.jpg" alt="Page not found" width="70%" />
</div>
</div>
<br><br>
{/if}
<!--<a href="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg">-->
<!--<img src="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg" />-->
<!--</a>-->
<!--<a href="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg">-->
<!--<img src="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg" />-->
<!--</a>-->
</div> </div>
</div> </div>

+ 1
- 0
utils/pageBuilder.js View File

@ -188,6 +188,7 @@ module.exports =
var templateContext = Object(); var templateContext = Object();
Promise.all([includes.include("templates/" + templateFile), Promise.all([includes.include("templates/" + templateFile),
includes.printHeader(templateContext), includes.printHeader(templateContext),
templateFiller(request.url, request, templateContext),
includes.printFooter(templateContext), includes.printFooter(templateContext),
require("../blog/sidebar.js").main(templateContext)]) require("../blog/sidebar.js").main(templateContext)])
.then(function (content) .then(function (content)

Loading…
Cancel
Save