mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-24 15:52:38 +02:00
remove pointer from epub image
This commit is contained in:
parent
b1e246240c
commit
5404390fd8
@ -24,47 +24,47 @@ type Image struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SpaceKey key name of the blank page after the image
|
// 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)
|
return fmt.Sprintf("space_%d", i.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SpacePath path of the blank page
|
// SpacePath path of the blank page
|
||||||
func (i *Image) SpacePath() string {
|
func (i Image) SpacePath() string {
|
||||||
return fmt.Sprintf("Text/%s.xhtml", i.SpaceKey())
|
return fmt.Sprintf("Text/%s.xhtml", i.SpaceKey())
|
||||||
}
|
}
|
||||||
|
|
||||||
// EPUBSpacePath path of the blank page into the EPUB
|
// 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())
|
return fmt.Sprintf("OEBPS/%s", i.SpacePath())
|
||||||
}
|
}
|
||||||
|
|
||||||
// PageKey key for page
|
// 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)
|
return fmt.Sprintf("page_%d_p%d", i.Id, i.Part)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PagePath page path linked to the image
|
// 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())
|
return fmt.Sprintf("Text/%s.xhtml", i.PageKey())
|
||||||
}
|
}
|
||||||
|
|
||||||
// EPUBPagePath page path into the EPUB
|
// EPUBPagePath page path into the EPUB
|
||||||
func (i *Image) EPUBPagePath() string {
|
func (i Image) EPUBPagePath() string {
|
||||||
return fmt.Sprintf("OEBPS/%s", i.PagePath())
|
return fmt.Sprintf("OEBPS/%s", i.PagePath())
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImgKey key for image
|
// 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)
|
return fmt.Sprintf("img_%d_p%d", i.Id, i.Part)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImgPath image path
|
// ImgPath image path
|
||||||
func (i *Image) ImgPath() string {
|
func (i Image) ImgPath() string {
|
||||||
return fmt.Sprintf("Images/%s.%s", i.ImgKey(), i.Format)
|
return fmt.Sprintf("Images/%s.%s", i.ImgKey(), i.Format)
|
||||||
}
|
}
|
||||||
|
|
||||||
// EPUBImgPath image path into the EPUB
|
// EPUBImgPath image path into the EPUB
|
||||||
func (i *Image) EPUBImgPath() string {
|
func (i Image) EPUBImgPath() string {
|
||||||
return fmt.Sprintf("OEBPS/%s", i.ImgPath())
|
return fmt.Sprintf("OEBPS/%s", i.ImgPath())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ func (i *Image) EPUBImgPath() string {
|
|||||||
//
|
//
|
||||||
// center by default.
|
// center by default.
|
||||||
// align to left or right if it's part of the split double page.
|
// 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)
|
relWidth, relHeight := i.RelSize(viewWidth, viewHeight)
|
||||||
marginW, marginH := float64(viewWidth-relWidth)/2, float64(viewHeight-relHeight)/2
|
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, "; ")
|
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
|
w, h := viewWidth, viewHeight
|
||||||
srcw, srch := i.Width, i.Height
|
srcw, srch := i.Width, i.Height
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user