From 5404390fd803b7da27c8ce07c4b5bb01771d542d Mon Sep 17 00:00:00 2001 From: celogeek <65178+celogeek@users.noreply.github.com> Date: Sat, 11 May 2024 14:25:52 +0200 Subject: [PATCH] remove pointer from epub image --- internal/epub/image/epub_image.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/epub/image/epub_image.go b/internal/epub/image/epub_image.go index 8c3a2ed..1578ceb 100644 --- a/internal/epub/image/epub_image.go +++ b/internal/epub/image/epub_image.go @@ -24,47 +24,47 @@ type Image struct { } // SpaceKey key name of the blank page after the image -func (i *Image) SpaceKey() string { +func (i Image) SpaceKey() string { return fmt.Sprintf("space_%d", i.Id) } // SpacePath path of the blank page -func (i *Image) SpacePath() string { +func (i Image) SpacePath() string { return fmt.Sprintf("Text/%s.xhtml", i.SpaceKey()) } // EPUBSpacePath path of the blank page into the EPUB -func (i *Image) EPUBSpacePath() string { +func (i Image) EPUBSpacePath() string { return fmt.Sprintf("OEBPS/%s", i.SpacePath()) } // PageKey key for page -func (i *Image) PageKey() string { +func (i Image) PageKey() string { return fmt.Sprintf("page_%d_p%d", i.Id, i.Part) } // PagePath page path linked to the image -func (i *Image) PagePath() string { +func (i Image) PagePath() string { return fmt.Sprintf("Text/%s.xhtml", i.PageKey()) } // EPUBPagePath page path into the EPUB -func (i *Image) EPUBPagePath() string { +func (i Image) EPUBPagePath() string { return fmt.Sprintf("OEBPS/%s", i.PagePath()) } // ImgKey key for image -func (i *Image) ImgKey() string { +func (i Image) ImgKey() string { return fmt.Sprintf("img_%d_p%d", i.Id, i.Part) } // ImgPath image path -func (i *Image) ImgPath() string { +func (i Image) ImgPath() string { return fmt.Sprintf("Images/%s.%s", i.ImgKey(), i.Format) } // EPUBImgPath image path into the EPUB -func (i *Image) EPUBImgPath() string { +func (i Image) EPUBImgPath() string { return fmt.Sprintf("OEBPS/%s", i.ImgPath()) } @@ -72,7 +72,7 @@ func (i *Image) EPUBImgPath() string { // // center by default. // align to left or right if it's part of the split double page. -func (i *Image) ImgStyle(viewWidth, viewHeight int, align string) string { +func (i Image) ImgStyle(viewWidth, viewHeight int, align string) string { relWidth, relHeight := i.RelSize(viewWidth, viewHeight) marginW, marginH := float64(viewWidth-relWidth)/2, float64(viewHeight-relHeight)/2 @@ -97,7 +97,7 @@ func (i *Image) ImgStyle(viewWidth, viewHeight int, align string) string { return strings.Join(style, "; ") } -func (i *Image) RelSize(viewWidth, viewHeight int) (relWidth, relHeight int) { +func (i Image) RelSize(viewWidth, viewHeight int) (relWidth, relHeight int) { w, h := viewWidth, viewHeight srcw, srch := i.Width, i.Height