Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example with scaled images #160

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions exampleSite/content/homepage/scaleImage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: "Example to Scale Images"
header_menu_title: "Scale Image"
navigation_menu_title: "Scale Image"
weight: 5
header_menu: true
---

 

#### Full Size

##### self-rendered by own function
![Jane Doe](images/happy-ethnic-woman_2000x2000_transparent.png)

##### rendered by figure
{{< figure src="images/happy-ethnic-woman_2000x2000_transparent.png">}}

---

#### 60% Size

##### self-rendered by own function
![Jane Doe](images/happy-ethnic-woman_2000x2000_transparent.png "60%")

##### rendered by figure
{{< figure src="images/happy-ethnic-woman_2000x2000_transparent.png" width="60%">}}

---

#### 20% Size

##### self-rendered by own function
![Jane Doe](images/happy-ethnic-woman_2000x2000_transparent.png "20%")

##### rendered by figure
{{< figure src="images/happy-ethnic-woman_2000x2000_transparent.png" width="20%">}}


---

#### adjusted Size 60% - 70%

##### self-rendered by own function (60%)
![Jane Doe](images/happy-ethnic-woman_2000x2000_transparent.png "60%")

##### rendered by figure (70%)
{{< figure src="images/happy-ethnic-woman_2000x2000_transparent.png" width="70%">}}


#### Lorem ipsum

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
<img
src="{{ .Destination | safeURL }}" alt="{{ .Text }}"
{{ with $image }}
width="{{ $image.Width }}" height="{{ $image.Height }}"
{{ end }}
{{ with .Title}} style="width: 100%; max-width: {{ . }};"{{ end }}
/>