remove pointer from epub image

This commit is contained in:
Celogeek 2024-05-11 14:25:52 +02:00
parent b1e246240c
commit 5404390fd8
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc

View File

@ -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