func ImageMetaHandler(writer http.ResponseWriter, req *http.Request) {
	TAG := "panopticon.ImageMetaHandler"
	notFound := httputil.NewJSONAssertable(writer, TAG, http.StatusNotFound, missingImage)
	badReq := httputil.NewJSONAssertable(writer, TAG, http.StatusBadRequest, clientError)
	ise := httputil.NewJSONAssertable(writer, TAG, http.StatusInternalServerError, internalError)

	imgID := httputil.ExtractSegment(req.URL.Path, 3)
	badReq.Assert(imgID != "" && imgID != "undefined", "bogus image ID '%s'", imgID)

	img := Repository.Locate(imgID)
	notFound.Assert(img != nil, "unknown image '%s'", imgID)

	u := userFor(req)
	camera := System.GetCamera(img.Source)
	ise.Assert(camera != nil, "image '%s' references unknown camera '%s'", img.Handle, img.Source)
	notFound.Assert(!camera.Private || u.Privileged, "attempt by '%s' to access private '%s'", u.Email, camera.ID)

	t := img.Timestamp
	loc := camera.Location()
	if loc != nil {
		t = t.In(loc)
	}
	res := &messages.ImageMeta{
		Handle:   img.Handle,
		Camera:   camera.Name,
		Time:     t.Format("3:04pm"),
		Date:     t.Format("Monday, 2 January, 2006"),
		HasVideo: img.HasVideo,
	}

	httputil.SendJSON(writer, http.StatusOK, &APIResponse{Artifact: res})
}
// ImageMetaHandler handles /client/imagemeta
ImageMetaHandler handles /client/imagemeta
// ImageMetaHandler handles / client / imagemeta
func ImageMetaHandler(writer http.ResponseWriter, req *http.Request) {
	TAG := "panopticon.ImageMetaHandler"
	notFound := httputil.NewJSONAssertable(writer, TAG, http.StatusNotFound, missingImage)
	badReq := httputil.NewJSONAssertable(writer, TAG, http.StatusBadRequest, clientError)
	ise := httputil.NewJSONAssertable(writer, TAG, http.StatusInternalServerError, internalError)
	imgID := httputil.ExtractSegment(req.URL.Path, 3)
	badReq.Assert(imgID != "" && imgID != "undefined", "bogus image ID '%s'", imgID)
	img := Repository.Locate(imgID)
	notFound.Assert(img != nil, "unknown image '%s'", imgID)
	u := userFor(req)
	camera := System.GetCamera(img.Source)
	ise.Assert(camera != nil, "image '%s' references unknown camera '%s'", img.Handle, img.Source)
	notFound.Assert(!camera.Private || u.Privileged, "attempt by '%s' to access private '%s'", u.Email, camera.ID)
	t := img.Timestamp
	loc := camera.Location()
	if loc != nil {
		t = t.In(loc)
	}
	res := &messages.ImageMeta{
		Handle:   img.Handle,
		Camera:   camera.Name,
		Time:     t.Format("3:04pm"),
		Date:     t.Format("Monday, 2 January, 2006"),
		HasVideo: img.HasVideo,
	}
	httputil.SendJSON(writer, http.StatusOK, &APIResponse{Artifact: res})
}
func ImageMetaHandler ( writer http . ResponseWriter , req * http . Request ) { TAG := " " notFound := httputil . NewJSONAssertable ( writer , TAG , http . StatusNotFound , missingImage ) badReq := httputil . NewJSONAssertable ( writer , TAG , http . StatusBadRequest , clientError ) ise := httputil . NewJSONAssertable ( writer , TAG , http . StatusInternalServerError , internalError ) imgID := httputil . ExtractSegment ( req . URL . Path , 3 ) badReq . Assert ( imgID != " " && imgID != " " , " " , imgID ) img := Repository . Locate ( imgID ) notFound . Assert ( img != nil , " " , imgID ) u := userFor ( req ) camera := System . GetCamera ( img . Source ) ise . Assert ( camera != nil , " " , img . Handle , img . Source ) notFound . Assert ( ! camera . Private || u . Privileged , " " , u . Email , camera . ID ) t := img . Timestamp loc := camera . Location ( ) if loc != nil { t = t . In ( loc ) } res := & messages . ImageMeta { Handle : img . Handle , Camera : camera . Name , Time : t . Format ( " " ) , Date : t . Format ( " " ) , HasVideo : img . HasVideo , } httputil . SendJSON ( writer , http . StatusOK , & APIResponse { Artifact : res } ) }
ImageMetaHandler handles /client/imagemeta
ImageMetaHandler handles / client / imagemeta