Fix url path

This commit is contained in:
Balakrishnan Balasubramanian 2024-08-08 22:10:55 -04:00
parent 1db7b2b4ad
commit 04a5dd62b6
2 changed files with 6 additions and 6 deletions

View File

@ -24,7 +24,6 @@ import (
)
var (
imagesDir string
collageDir string
photosDir string
devMode bool
@ -41,7 +40,6 @@ var (
func main() {
var ppURL string
flag.StringVar(&imagesDir, "images-dir", "images", "Sets the images dir")
flag.StringVar(&collageDir, "collages-dir", "collages", "Sets the collages dir")
flag.StringVar(&photosDir, "photos-dir", "photos", "Cache directory for downloaded photos")
flag.BoolVar(&devMode, "dev", false, "Serve local assets during development")
@ -59,8 +57,7 @@ func main() {
return photoPrismURL
}()
collageNameGen = NewNameGen()
imagesDirFs = os.DirFS(imagesDir)
imagesURLPath := "images"
imagesDirFs = os.DirFS(photosDir)
collagesPath := "collages"
photosPath := "photos"
@ -69,7 +66,6 @@ func main() {
http.Handle("/"+path+"/", http.StripPrefix("/"+path, httpFileServer))
}
addFileServer(imagesURLPath, imagesDir)
addFileServer(collagesPath, collageDir)
addFileServer(photosPath, photosDir)

View File

@ -148,8 +148,12 @@ function snap() {
const fsx = elem.offsetLeft - col
const fsy = elem.offsetTop - cot
const [sx, sy, ex, ey] = cpie.get().points;
const imageFile = (() => {
const u = new URL(elem.dataset.collageImageUrl)
return u.pathname.slice("/photos/".length)
})();
const photo = {
image: elem.dataset.collageImageUrl.slice("images/".length),
image: imageFile,
crop: {
start: {
x: parseInt(sx),