forked from website/openpower.foundation
				
			add image shortcode for image optimization in content
Signed-off-by: Toshaan Bharvani <toshaan@vantosh.com>newmemberlevels
							parent
							
								
									294e145432
								
							
						
					
					
						commit
						e00d6c7083
					
				@ -0,0 +1,15 @@
 | 
			
		||||
{{ $src := .Get "src" }}
 | 
			
		||||
{{ $imagesrc := (printf "images/%s" $src) }}
 | 
			
		||||
{{ $width := .Get "width" }}
 | 
			
		||||
{{ $height := .Get "height" }}
 | 
			
		||||
{{ $imageresource := resources.Get $imagesrc }}
 | 
			
		||||
{{ if eq $width "" }}
 | 
			
		||||
	{{ $width = "500" }}
 | 
			
		||||
{{ end }}
 | 
			
		||||
{{ if eq $height "" }}
 | 
			
		||||
	{{ $height = "500" }}
 | 
			
		||||
{{ end }}
 | 
			
		||||
{{ $imageprocessing := (printf "%sx%s %s" $width $height "webp") }}
 | 
			
		||||
{{ $image := $imageresource.Fit $imageprocessing }}
 | 
			
		||||
<img src="{{ $image.RelPermalink }}">
 | 
			
		||||
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue