diff --git a/images/consts.go b/images/consts.go deleted file mode 100644 index aa20c4b94..000000000 --- a/images/consts.go +++ /dev/null @@ -1,4 +0,0 @@ -package images - -// TODO find the best location to put the new files -const ImageDir = "assets/" diff --git a/images/files.go b/images/files.go index a7fc9b164..fae87c808 100644 --- a/images/files.go +++ b/images/files.go @@ -105,7 +105,7 @@ func isWebp(buf []byte) bool { buf[10] == 0x42 && buf[11] == 0x50 } -func MakeAndRenderFile(img image.Image, imgDetail *Details) error { +func RenderAndMakeFile(img image.Image, imgDetail *Details) error { out, err := os.Create(imgDetail.FileName) if err != nil { return err diff --git a/images/files_test.go b/images/files_test.go index 131303121..669240557 100644 --- a/images/files_test.go +++ b/images/files_test.go @@ -160,7 +160,7 @@ func TestMakeAndRenderFile(t *testing.T) { Quality: 70, } - err = MakeAndRenderFile(img, options) + err = RenderAndMakeFile(img, options) require.NoError(t, err) require.Exactly(t, c.OutputSize, options.SizeFile) diff --git a/images/meta.go b/images/meta.go index 41d532a5e..6fe77d517 100644 --- a/images/meta.go +++ b/images/meta.go @@ -1,10 +1,5 @@ package images -import ( - "fmt" - "strings" -) - const ( UNKNOWN FileType = 1 + iota @@ -25,18 +20,3 @@ type Details struct { type FileType uint -func NewDetails(imageName string, size uint, quality int, properties string) Details { - return Details{ - SizePixel: size, - Quality: quality, - Properties: properties, - FileName: makeOutputName(imageName, size, quality, properties), - } -} - -func makeOutputName(imageName string, size uint, i int, properties string) string { - if properties != "" { - properties = "_" + strings.ReplaceAll(properties, " ", "-") - } - return fmt.Sprintf(ImageDir+"%s_s-%d_q-%d%s.jpg", imageName, size, i, properties) -} diff --git a/images/meta_test.go b/images/meta_test.go deleted file mode 100644 index 2f22fe3e6..000000000 --- a/images/meta_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package images - -import ( - "fmt" - "testing" -) - -func TestFileTypes(t *testing.T) { - fmt.Printf("%d\n", WEBP) - fmt.Printf("%d\n", SVG) - fmt.Printf("%d\n", AI) -}