mirror of
				https://github.com/thomasjsn/hugo-theme-hello-friend.git
				synced 2025-11-04 08:48:47 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
		
			911 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			911 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
 | 
						|
{{ $command := .Get 1 }}
 | 
						|
{{ $options := .Get 2 }}
 | 
						|
{{ $position := .Get 3 }}
 | 
						|
 | 
						|
{{ if eq $command "Fit" }}
 | 
						|
  {{ .Scratch.Set "image" ($original.Fit $options) }}
 | 
						|
  {{ else if eq $command "Resize" }}
 | 
						|
  {{ .Scratch.Set "image" ($original.Resize $options) }}
 | 
						|
  {{ else if eq $command "Fill" }}
 | 
						|
  {{ .Scratch.Set "image" ($original.Fill $options) }}
 | 
						|
  {{ else }}
 | 
						|
  {{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize." }}
 | 
						|
{{ end }}
 | 
						|
 | 
						|
{{ $image := .Scratch.Get "image" }}
 | 
						|
 | 
						|
<figure class="{{ with $position }}{{ . }}{{ else -}} left {{- end }}">
 | 
						|
  <img
 | 
						|
    style="max-width: 100%; width: auto; height: auto; border-radius: 8px;"
 | 
						|
    src="{{ $image.RelPermalink }}"
 | 
						|
    width="{{ $image.Width }}"
 | 
						|
    height="{{ $image.Height }}"
 | 
						|
  />
 | 
						|
  {{ with .Inner }}
 | 
						|
    <figcaption>
 | 
						|
      {{ . }}
 | 
						|
    </figcaption>
 | 
						|
  {{ end }}
 | 
						|
</figure>
 |