Skip to content

Commit

Permalink
chore: upgrade imagemagick
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc committed Oct 18, 2024
1 parent abf83f5 commit 15da1cc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/stretchr/testify v1.8.1
golang.org/x/net v0.17.0
golang.org/x/text v0.13.0
gopkg.in/gographics/imagick.v2 v2.6.0
gopkg.in/gographics/imagick.v3 v3.7.1
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/gographics/imagick.v2 v2.6.0 h1:ewRsUQk3QkjGumERlndbFn/kTYRjyMaPY5gxwpuAhik=
gopkg.in/gographics/imagick.v2 v2.6.0/go.mod h1:/QVPLV/iKdNttRKthmDkeeGg+vdHurVEPc8zkU0XgBk=
gopkg.in/gographics/imagick.v3 v3.7.1 h1:YS5haF8HrPzDJJ2+o6ciLgdaUwYqI5wlSJpg7WcnTIs=
gopkg.in/gographics/imagick.v3 v3.7.1/go.mod h1:+Q9nyA2xRZXrDyTtJ/eko+8V/5E7bWYs08ndkZp8UmA=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
11 changes: 8 additions & 3 deletions telegram/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"yubari/pixiv"

tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"gopkg.in/gographics/imagick.v2/imagick"
"gopkg.in/gographics/imagick.v3/imagick"
)

func onStart(b *Bot, message *tgbotapi.Message) {
Expand Down Expand Up @@ -140,15 +140,20 @@ func onPixivNoArgs(b *Bot, message *tgbotapi.Message) {
width := mw.GetImageWidth()
height := mw.GetImageHeight()

err = mw.ResizeImage(640, 640*height/width, 0, 1)
err = mw.ResizeImage(640, 640*height/width, imagick.FILTER_BOX)
if err != nil {
b.logger.Errorf("resize image failed: %s", err)
return
}

blob, err := mw.GetImageBlob()
if err != nil {
b.logger.Errorf("get image blob failed: %s", err)
return
}
msg := tgbotapi.NewPhoto(message.Chat.ID, tgbotapi.FileBytes{
Name: fileName,
Bytes: mw.GetImageBlob(),
Bytes: blob,
})
msg.ParseMode = tgbotapi.ModeHTML
msg.Caption = fmt.Sprintf(
Expand Down
2 changes: 1 addition & 1 deletion yubari.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/go-redis/redis"
bt "github.com/ikool-cn/gobeanstalk-connection-pool"
meilisearch "github.com/meilisearch/meilisearch-go"
"gopkg.in/gographics/imagick.v2/imagick"
"gopkg.in/gographics/imagick.v3/imagick"

"yubari/mastodon"
"yubari/pixiv"
Expand Down

0 comments on commit 15da1cc

Please sign in to comment.