Use Image Processing to resize images

This commit is contained in:
Hanzei 2018-07-06 14:27:34 +02:00
parent 32d393c2df
commit 088c65bac5
No known key found for this signature in database
GPG key ID: 69A2DEFD98937BA0
40 changed files with 102 additions and 22 deletions

View file

@ -1,6 +1,5 @@
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
image: ""
external_link: ""
weight: 0
draft: true

View file

@ -28,7 +28,6 @@ theme = "introduction"
shareGooglePlus = true
numberOfProjectsToShow = 3 # Maximum number of projects to show on home page. Unset or comment out to show all projects.
placeHolderimg = "/img/workday.jpg" # For Projects without image
# Social icons appear in introduction and contact section. Add as many more as you like.
# Find icon names here: http://fontawesome.io/cheatsheet/

View file

@ -1,7 +1,10 @@
---
title: "Design"
image: "img/plant.jpg"
weight: 2
resources:
- src: plant.jpg
params:
weight: -100
---
Dieses Theme wurde von [Vicky Lai](https://vickylai.com) entwickelt. Guck es dir an! 💪

View file

@ -1,6 +1,5 @@
---
title: "Fotografie"
image: "img/camera.jpg"
weight: 1
---

View file

@ -1,6 +1,5 @@
---
title: "Schreiben"
image: "img/workday.jpg"
weight: 3
---

0
exampleSite/content/en/about.md Executable file → Normal file
View file

0
exampleSite/content/en/blog/coffee-ipsum.md Executable file → Normal file
View file

0
exampleSite/content/en/blog/hipster-ipsum.md Executable file → Normal file
View file

0
exampleSite/content/en/blog/startup-ipsum.md Executable file → Normal file
View file

0
exampleSite/content/en/contact.md Executable file → Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 KiB

View file

@ -1,7 +1,10 @@
---
title: "Design"
image: "img/plant.jpg"
weight: 2
resources:
- src: plant.jpg
params:
weight: -100
---
This theme was designed by [Vicky Lai](https://vickylai.com). Go on, explore! 💪

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -1,6 +1,5 @@
---
title: "Photography"
image: "img/camera.jpg"
weight: 1
---

View file

@ -1,6 +1,5 @@
---
title: "Writing"
image: "img/workday.jpg"
weight: 3
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -1,7 +1,10 @@
---
title: "Diseño"
image: "img/plant.jpg"
weight: 2
resources:
- src: plant.jpg
params:
weight: -100
---
Este tema fue diseñado por [Vicky Lai](https://vickylai.io). Ve, explora! 💪

View file

@ -1,6 +1,5 @@
---
title: "Fotografía"
image: "img/camera.jpg"
weight: 1
---

View file

@ -1,6 +1,5 @@
---
title: "Escribiendo"
image: "img/workday.jpg"
weight: 3
---

View file

@ -7,6 +7,9 @@
{{ partial "head/favicons.html" . }}
{{ partial "head/css.html" . }}
{{ end }}
<!-- Include page specific css -->
{{ block "customCSS" . }}
{{ end }}
</head>
<body>
<div class="section" id="top">
@ -32,5 +35,8 @@
{{ block "js-include" . }}
{{ partial "footer/scripts.html" . }}
{{ end }}
<!-- Include page specific scritps -->
{{ block "customScripts" . }}
{{ end }}
</body>
</html>

View file

@ -3,8 +3,11 @@
<meta property="og:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.description }}{{ end }}"/>
<meta property="og:url" content="{{ .Permalink }}"/>
<meta property="og:site_name" content="{{ .Site.Title }}"/>
{{ if .Params.image }}
<meta property="og:image" content="{{ .Params.image | absURL }}"/>
{{ with .Resources.ByType "image" }}
{{ range first 5 (sort . "Params.weight") }}
<meta property="og:image" content="{{ .Permalink }}"/>
{{ end }}
{{ else }}
<meta property="og:image" content="{{ .Site.Params.avatar | absURL }}"/>
{{ end }}

View file

@ -19,7 +19,12 @@
<div class="card-image">
<figure class="image is-3by2">
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
<img src="{{ if .Params.image }}{{ .Params.image | relURL }}{{ else }}{{ (.Site.Params.placeHolderimg | default "/img/workday.jpg") | relURL }}{{ end }}" alt="{{ .Title }}">
{{ with .Resources.ByType "image" }}
{{ range first 1 (sort . "Params.weight") }}
{{ $image := .Resize "302x" }}
<img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}">
{{ end }}
{{ end }}
</a>
</figure>
</div>
@ -51,12 +56,17 @@
<p class="modal-card-title has-text-centered">{{ . }}</p>
</header>
{{ end }}
{{ if .Params.image }}
<img src="{{ .Params.image | relURL }}" alt="{{ .Title }}" class="img-responsive img-centered">
{{ with .Resources.ByType "image" }}
{{ range first 1 (sort . "Params.weight") }}
{{ $image := .Resize "640x" }}
<img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}">
{{ end }}
{{ if .Content }}
{{ end }}
{{ with .Content }}
<section class="modal-card-body markdown">
{{ .Content }}
{{ . }}
</section>
{{ end }}
</div>

View file

@ -15,8 +15,13 @@
<div class="card">
<div class="card-image">
<figure class="image is-3by2">
<a href="{{ if .Params.external_link }}{{ .Params.external_link }}{{ else }}{{.Permalink}}{{ end }}">
<img src="{{ if .Params.image }}{{ .Params.image | relURL }}{{ else }}{{ (.Site.Params.placeHolderimg | default "/img/workday.jpg") | relURL }}{{ end }}" alt="{{ .Title }}">
<a href="{{ if .Params.external_link }}{{ .Params.external_link }}{{ else }}{{ .Permalink }}{{ end }}">
{{ with .Resources.ByType "image" }}
{{ range first 1 (sort . "Params.weight") }}
{{ $image := .Resize "302x" }}
<img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}">
{{ end }}
{{ end }}
</a>
</figure>
</div>

View file

@ -1,8 +1,24 @@
{{ define "main" }}
<div class="container markdown top-pad">
{{ if .Params.image }}
{{ with .Resources.ByType "image" }}
<div class="has-text-centered">
<img src="{{ .Params.image | relURL }}" class="img-responsive" alt="{{ .Title }}">
{{ $moreThenOneImage := gt (len .) 1 }}
{{ if $moreThenOneImage }}
<div class="owl-carousel owl-theme">
{{ end }}
{{ range sort . "Params.weight" }}
{{ $image := .Resize "1000x" }}
{{ if $moreThenOneImage }}
<div class="item owl-height">
{{ end }}
<img src="{{ $image.RelPermalink }}" class="img-responsive" alt="{{ $image.Name }}">
{{ if $moreThenOneImage }}
</div>
{{ end }}
{{ end }}
{{ if $moreThenOneImage }}
</div>
{{ end }}
</div>
{{ end }}
{{ .Content }}
@ -12,3 +28,23 @@
{{ template "_internal/disqus.html" . }}
</div>
{{ end }}
{{ define "customCSS" }}
<link rel="stylesheet" href="{{ "css/owl.carousel.min.css" | relURL }}">
<link rel="stylesheet" href="{{ "css/owl.theme.default.min.css" | relURL }}">
{{ end }}
{{ define "customScripts" }}
<script src="{{ "js/owl.carousel.min.js" | relURL }}"></script>
<script>
$(document).ready(function(){
$(".owl-carousel").owlCarousel({
loop: true,
nav: true,
margin: 10,
items: 1,
autoHeight: true
});
});
</script>
{{ end }}

6
static/css/owl.carousel.min.css vendored Normal file
View file

@ -0,0 +1,6 @@
/**
* Owl Carousel v2.3.4
* Copyright 2013-2018 David Deutsch
* Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
*/
.owl-carousel,.owl-carousel .owl-item{-webkit-tap-highlight-color:transparent;position:relative}.owl-carousel{display:none;width:100%;z-index:1}.owl-carousel .owl-stage{position:relative;-ms-touch-action:pan-Y;touch-action:manipulation;-moz-backface-visibility:hidden}.owl-carousel .owl-stage:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}.owl-carousel .owl-stage-outer{position:relative;overflow:hidden;-webkit-transform:translate3d(0,0,0)}.owl-carousel .owl-item,.owl-carousel .owl-wrapper{-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0)}.owl-carousel .owl-item{min-height:1px;float:left;-webkit-backface-visibility:hidden;-webkit-touch-callout:none}.owl-carousel .owl-item img{display:block;width:100%}.owl-carousel .owl-dots.disabled,.owl-carousel .owl-nav.disabled{display:none}.no-js .owl-carousel,.owl-carousel.owl-loaded{display:block}.owl-carousel .owl-dot,.owl-carousel .owl-nav .owl-next,.owl-carousel .owl-nav .owl-prev{cursor:pointer;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.owl-carousel .owl-nav button.owl-next,.owl-carousel .owl-nav button.owl-prev,.owl-carousel button.owl-dot{background:0 0;color:inherit;border:none;padding:0!important;font:inherit}.owl-carousel.owl-loading{opacity:0;display:block}.owl-carousel.owl-hidden{opacity:0}.owl-carousel.owl-refresh .owl-item{visibility:hidden}.owl-carousel.owl-drag .owl-item{-ms-touch-action:pan-y;touch-action:pan-y;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.owl-carousel.owl-grab{cursor:move;cursor:grab}.owl-carousel.owl-rtl{direction:rtl}.owl-carousel.owl-rtl .owl-item{float:right}.owl-carousel .animated{animation-duration:1s;animation-fill-mode:both}.owl-carousel .owl-animated-in{z-index:0}.owl-carousel .owl-animated-out{z-index:1}.owl-carousel .fadeOut{animation-name:fadeOut}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}.owl-height{transition:height .5s ease-in-out}.owl-carousel .owl-item .owl-lazy{opacity:0;transition:opacity .4s ease}.owl-carousel .owl-item .owl-lazy:not([src]),.owl-carousel .owl-item .owl-lazy[src^=""]{max-height:0}.owl-carousel .owl-item img.owl-lazy{transform-style:preserve-3d}.owl-carousel .owl-video-wrapper{position:relative;height:100%;background:#000}.owl-carousel .owl-video-play-icon{position:absolute;height:80px;width:80px;left:50%;top:50%;margin-left:-40px;margin-top:-40px;background:url(owl.video.play.png) no-repeat;cursor:pointer;z-index:1;-webkit-backface-visibility:hidden;transition:transform .1s ease}.owl-carousel .owl-video-play-icon:hover{-ms-transform:scale(1.3,1.3);transform:scale(1.3,1.3)}.owl-carousel .owl-video-playing .owl-video-play-icon,.owl-carousel .owl-video-playing .owl-video-tn{display:none}.owl-carousel .owl-video-tn{opacity:0;height:100%;background-position:center center;background-repeat:no-repeat;background-size:contain;transition:opacity .4s ease}.owl-carousel .owl-video-frame{position:relative;z-index:1;height:100%;width:100%}

6
static/css/owl.theme.default.min.css vendored Normal file
View file

@ -0,0 +1,6 @@
/**
* Owl Carousel v2.3.4
* Copyright 2013-2018 David Deutsch
* Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
*/
.owl-theme .owl-dots,.owl-theme .owl-nav{text-align:center;-webkit-tap-highlight-color:transparent}.owl-theme .owl-nav{margin-top:10px}.owl-theme .owl-nav [class*=owl-]{color:#FFF;font-size:14px;margin:5px;padding:4px 7px;background:#D6D6D6;display:inline-block;cursor:pointer;border-radius:3px}.owl-theme .owl-nav [class*=owl-]:hover{background:#869791;color:#FFF;text-decoration:none}.owl-theme .owl-nav .disabled{opacity:.5;cursor:default}.owl-theme .owl-nav.disabled+.owl-dots{margin-top:10px}.owl-theme .owl-dots .owl-dot{display:inline-block;zoom:1}.owl-theme .owl-dots .owl-dot span{width:10px;height:10px;margin:5px 7px;background:#D6D6D6;display:block;-webkit-backface-visibility:visible;transition:opacity .2s ease;border-radius:30px}.owl-theme .owl-dots .owl-dot.active span,.owl-theme .owl-dots .owl-dot:hover span{background:#869791}

7
static/js/owl.carousel.min.js vendored Normal file

File diff suppressed because one or more lines are too long