~jheckt/PhotographyWebsite

fcfafe4f1d9880a2a51a020efe281f0d28247363 — turnipsoup 1 year, 3 months ago 18b560a exif-preload
exif preload fully works, thanks ChatGPT
2 files changed, 12 insertions(+), 4 deletions(-)

M main.go
M photos.go
M main.go => main.go +1 -0
@@ 11,6 11,7 @@ import (
const PHOTOPATH = "photos"
const AVERAGEPATH = "averages"

// Preloading the EXIF data for the images
var ExData = exifPreload()

func init() {

M photos.go => photos.go +11 -4
@@ 200,11 200,18 @@ func exifPreload() ExifData {
		photoFiles := loadCollectionFilesByType(photoDirs[i], "png", false)

		for pf := range photoFiles {
			var photoExif = make(map[string]interface{})
			cleanFilename := getJustFilename(photoFiles[pf])
			photoExif[cleanFilename] = getExifData(photoDirs[i], getJustFilename(photoFiles[pf]))
			log.Info(photoExif, ED.Photos)
			ED.Photos[cleanFilename] = photoExif
			var photoExif = getExifData(photoDirs[i], cleanFilename)

			// Merge all maps in the slice into a single map
			mergedExif := make(map[string]interface{})
			for j := range photoExif {
				for k, v := range photoExif[j] {
					mergedExif[k] = v
				}
			}

			ED.Photos[cleanFilename] = mergedExif

		}
	}