Compare commits

..

No commits in common. "efda3b72b8f433ff80b8b3d93f36d66d67d43a98" and "1db7b2b4adf973f36239d60ebaab135153be703a" have entirely different histories.

5 changed files with 7 additions and 12 deletions

View File

@ -10,7 +10,6 @@ import (
"io"
"io/fs"
"github.com/disintegration/imaging"
"go.oneofone.dev/resize"
)
@ -103,6 +102,6 @@ func GetImage(source fs.FS, imageName string) (image.Image, error) {
if err != nil {
return nil, err
}
img, err := imaging.Decode(imgF, imaging.AutoOrientation(true))
img, _, err := image.Decode(imgF)
return img, err
}

1
go.mod
View File

@ -3,7 +3,6 @@ module go.balki.me/collage-maker
go 1.22
require (
github.com/disintegration/imaging v1.6.2
go.balki.me/anyhttp v0.3.0
go.oneofone.dev/resize v1.0.1
)

3
go.sum
View File

@ -1,5 +1,3 @@
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.balki.me/anyhttp v0.3.0 h1:WtBQ0rnkg567sX/O4ij/+qBbdCIUt5VURSe718sITBY=
go.balki.me/anyhttp v0.3.0/go.mod h1:JhfekOIjgVODoVqUCficjpIgmB3wwlB7jhN0eN2EZ/s=
@ -7,7 +5,6 @@ go.oneofone.dev/resize v1.0.1 h1:HjpVar/4pxMGrjO44ThaMX1Q5UOBw0KxzbxxRDZPQuA=
go.oneofone.dev/resize v1.0.1/go.mod h1:zGFmn7q4EUZVlnDmxqf+b0mWpxsTt0MH2yx6ng8tpq0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.1.0 h1:r8Oj8ZA2Xy12/b5KZYj3tuv7NG/fBz3TwQVvpJ9l8Rk=
golang.org/x/image v0.1.0/go.mod h1:iyPr49SD/G/TBxYVB/9RRtGUT5eNbo2u4NamWeQcD5c=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=

View File

@ -24,6 +24,7 @@ import (
)
var (
imagesDir string
collageDir string
photosDir string
devMode bool
@ -40,6 +41,7 @@ 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")
@ -57,7 +59,8 @@ func main() {
return photoPrismURL
}()
collageNameGen = NewNameGen()
imagesDirFs = os.DirFS(photosDir)
imagesDirFs = os.DirFS(imagesDir)
imagesURLPath := "images"
collagesPath := "collages"
photosPath := "photos"
@ -66,6 +69,7 @@ func main() {
http.Handle("/"+path+"/", http.StripPrefix("/"+path, httpFileServer))
}
addFileServer(imagesURLPath, imagesDir)
addFileServer(collagesPath, collageDir)
addFileServer(photosPath, photosDir)

View File

@ -148,12 +148,8 @@ 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: imageFile,
image: elem.dataset.collageImageUrl.slice("images/".length),
crop: {
start: {
x: parseInt(sx),