From 1895f8815e31b3df884f9a86347df440f1e8f308 Mon Sep 17 00:00:00 2001 From: fumiama Date: Sat, 26 Feb 2022 22:09:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20gif=20=E7=88=AC=20=E6=92=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/gif/png.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugin/gif/png.go b/plugin/gif/png.go index 4714c3be..c8845d8f 100644 --- a/plugin/gif/png.go +++ b/plugin/gif/png.go @@ -4,8 +4,10 @@ import ( "errors" "image" "math/rand" + "os" "strconv" + "github.com/FloatTech/zbputils/file" "github.com/FloatTech/zbputils/img" "github.com/FloatTech/zbputils/img/writer" ) @@ -19,6 +21,12 @@ func (cc *context) A爬() (string, error) { } // 随机爬图序号 rand := rand.Intn(60) + 1 + if file.IsNotExist(datapath + "materials/pa") { + err = os.MkdirAll(datapath+"materials/pa", 0755) + if err != nil { + return "", err + } + } f, err := dlblock(`pa/` + strconv.Itoa(rand) + `.png`) if err != nil { return "", err @@ -39,6 +47,12 @@ func (cc *context) A撕() (string, error) { } im1 := img.Rotate(tou, 20, 380, 380) im2 := img.Rotate(tou, -12, 380, 380) + if file.IsNotExist(datapath + "materials/si") { + err = os.MkdirAll(datapath+"materials/si", 0755) + if err != nil { + return "", err + } + } f, err := dlblock(`si/0.png`) if err != nil { return "", err