EXIF error

tryed the new Exif function

<.Exif>: error calling Exif: runtime error: invalid memory address or nil pointer dereference

It’s real a image, .Fit and .Resize works

OS: Win64
anyone else get’s the same error? can file it as bug

.Exif can return nil even for “real images”. Exif is only JPG and TiFF, and even there you may have had software that have removed the Exif data.

I suggest you do this:

{{ with $img.Exif }}
{{ end }}

Or maybe I misread your question. If the Exif operation itself fails with the above error, you can create a GH issue. But it would be good if you could provide a link or something to the image that fails.

It’s now late, i will test it until friday
Tanks

1 Like

works not:

{{range .Resources.Match "gallery/*" }}	
        {{ with .Exif }} 
        	{{ .Date.Format site.Params.dateFormatLong }}
        {{end}}

works:

{{range .Resources.Match "gallery/*" }}	
	{{ if in "jpg tiff" .MediaType.SubType }}
		{{ with .Exif }} 
			{{ .Date.Format site.Params.dateFormatLong }}
		{{end}}
	{{ end }}

etc …

With hugo new photo* - I create an directory ./gallery, must have an placeholder file, bc. empty dirs will not copied / created. have empty placeholder.txt

Must change the .Match now.

1 Like