Add gif support by updating to gopdf v0.29.0 which supports gif files
This commit is contained in:
parent
a2a5bd7f00
commit
df5ad42e3e
3 changed files with 12 additions and 10 deletions
16
main.go
16
main.go
|
|
@ -435,15 +435,17 @@ func main() {
|
|||
var lowercaseImgLink string
|
||||
for idx, imgLink := range episodeBatch.imgLinks {
|
||||
lowercaseImgLink = strings.ToLower(imgLink)
|
||||
if strings.Contains(lowercaseImgLink, ".gif") {
|
||||
fmt.Println(fmt.Sprintf("WARNING: skipping gif %s", imgLink))
|
||||
continue
|
||||
}
|
||||
|
||||
fileFormat := "jpg"
|
||||
if strings.Contains(lowercaseImgLink, ".png") {
|
||||
err = comicFile.addImage(fetchImage(imgLink), "png")
|
||||
} else {
|
||||
err = comicFile.addImage(fetchImage(imgLink), "jpg")
|
||||
fileFormat = "png"
|
||||
} else if strings.Contains(lowercaseImgLink, ".gif") {
|
||||
fileFormat = "gif"
|
||||
}
|
||||
err = comicFile.addImage(fetchImage(imgLink), fileFormat)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue