Cleanup for 1.0 #18
1
Makefile
1
Makefile
@ -6,7 +6,6 @@ livereload:
|
|||||||
local:
|
local:
|
||||||
go run main.go --local-assets --images-dir w.tmp/images --collages-dir w.tmp
|
go run main.go --local-assets --images-dir w.tmp/images --collages-dir w.tmp
|
||||||
|
|
||||||
|
|
||||||
update_croppie:
|
update_croppie:
|
||||||
curl -Lo web/croppie.min.js https://github.com/Foliotek/Croppie/raw/v2.6.5/croppie.min.js
|
curl -Lo web/croppie.min.js https://github.com/Foliotek/Croppie/raw/v2.6.5/croppie.min.js
|
||||||
curl -Lo web/croppie.css https://github.com/Foliotek/Croppie/raw/v2.6.5/croppie.css
|
curl -Lo web/croppie.css https://github.com/Foliotek/Croppie/raw/v2.6.5/croppie.css
|
||||||
|
@ -104,17 +104,6 @@ func TestCrop(t *testing.T) {
|
|||||||
if string(refImgPrefix) != croppedImgPrefix {
|
if string(refImgPrefix) != croppedImgPrefix {
|
||||||
t.Fatalf("Cropped image is not the same as reference image")
|
t.Fatalf("Cropped image is not the same as reference image")
|
||||||
}
|
}
|
||||||
// SavePrefix(cropped)
|
|
||||||
// expectedImage, err := GetImage(testDataFS, "test_output.jpg")
|
|
||||||
// if err != nil {
|
|
||||||
// t.Fatalf("failed to get reference crop image %v", err)
|
|
||||||
// }
|
|
||||||
// fmt.Printf("%v\n", cropped)
|
|
||||||
// fmt.Printf("%v\n", expectedImage)
|
|
||||||
// if fmt.Sprintf("%#v", cropped) != fmt.Sprintf("%#v", expectedImage) {
|
|
||||||
// t.Fatalf("Cropped image is not the same as reference image")
|
|
||||||
// }
|
|
||||||
// SaveImage(cropped)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save first 1000 bytes of string representation to compare against reference
|
// Save first 1000 bytes of string representation to compare against reference
|
||||||
|
15
web/index.js
15
web/index.js
@ -114,14 +114,6 @@ function initCollage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showCrop() {
|
|
||||||
for(cpie of crops) {
|
|
||||||
console.log(cpie.get())
|
|
||||||
console.log(cpie.element.clientWidth)
|
|
||||||
console.log(cpie.element.clientHeight)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function makeCollage(req) {
|
async function makeCollage(req) {
|
||||||
const resp = await fetch("make-collage", {
|
const resp = await fetch("make-collage", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@ -136,7 +128,6 @@ async function makeCollage(req) {
|
|||||||
function snap() {
|
function snap() {
|
||||||
const col = collageDiv.offsetLeft;
|
const col = collageDiv.offsetLeft;
|
||||||
const cot = collageDiv.offsetTop;
|
const cot = collageDiv.offsetTop;
|
||||||
console.log("----------------------")
|
|
||||||
const req = {
|
const req = {
|
||||||
background_image: "",
|
background_image: "",
|
||||||
aspect: {
|
aspect: {
|
||||||
@ -152,11 +143,6 @@ function snap() {
|
|||||||
|
|
||||||
for(const elem of collageDiv.getElementsByClassName("img")) {
|
for(const elem of collageDiv.getElementsByClassName("img")) {
|
||||||
const cpie = crops[elem.dataset.collageCropieIndex]
|
const cpie = crops[elem.dataset.collageCropieIndex]
|
||||||
// console.log(cpie.get().points)
|
|
||||||
// console.log(elem.offsetLeft - col)
|
|
||||||
// console.log(elem.offsetTop - cot)
|
|
||||||
// console.log(elem.clientWidth)
|
|
||||||
// console.log(elem.clientHeight)
|
|
||||||
const fsx = elem.offsetLeft - col
|
const fsx = elem.offsetLeft - col
|
||||||
const fsy = elem.offsetTop - cot
|
const fsy = elem.offsetTop - cot
|
||||||
const [sx, sy, ex, ey] = cpie.get().points;
|
const [sx, sy, ex, ey] = cpie.get().points;
|
||||||
@ -186,7 +172,6 @@ function snap() {
|
|||||||
req.photos.push(photo)
|
req.photos.push(photo)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(JSON.stringify(req));
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const collagFile = await makeCollage(req)
|
const collagFile = await makeCollage(req)
|
||||||
collageUrlA.href = `collages/${collagFile}`;
|
collageUrlA.href = `collages/${collagFile}`;
|
||||||
|
Loading…
Reference in New Issue
Block a user