1
Fork 0

Update to magick 7 in alpine. (#1035)

This commit is contained in:
Googol Lee 2024-09-02 22:12:00 +02:00 committed by GitHub
parent 85c1e52b06
commit 6e1e1d12ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 8 deletions

View File

@ -37,17 +37,17 @@ func newMagickWorker() *MagickWorker {
return nil
}
path, err := exec.LookPath("convert")
path, err := exec.LookPath("magick")
if err != nil {
log.Println("Executable worker not found: ImageMagick convert")
log.Println("Executable worker not found: magick")
} else {
version, err := exec.Command(path, "--version").Output()
version, err := exec.Command(path, "-version").Output()
if err != nil {
log.Printf("Error getting version of ImageMagick convert: %s\n", err)
log.Printf("Error getting version of magick: %s\n", err)
return nil
}
log.Printf("Found executable worker: ImageMagick convert (%s)\n", strings.Split(string(version), "\n")[0])
log.Printf("Found executable worker: magick (%s)\n", strings.Split(string(version), "\n")[0])
return &MagickWorker{
path: path,
@ -93,6 +93,7 @@ func (worker *FfmpegWorker) IsInstalled() bool {
func (worker *MagickWorker) EncodeJpeg(inputPath string, outputPath string, jpegQuality int) error {
args := []string{
"convert",
inputPath,
"-quality", fmt.Sprintf("%d", jpegQuality),
outputPath,

View File

@ -49,7 +49,7 @@ func TestMagickWorker(t *testing.T) {
if err == nil {
t.Fatalf("MagickCli.EncodeJpeg(\"input\", \"output\", 0) = nil, should be an error.")
}
if got, want := err.Error(), "^encoding image with \".*?/testdata/bin/convert .*?\" error: .*$"; !regexp.MustCompile(want).MatchString(got) {
if got, want := err.Error(), "^encoding image with \".*?/testdata/bin/magick .*?\" error: .*$"; !regexp.MustCompile(want).MatchString(got) {
t.Errorf("MagickCli.EncodeJpeg(\"input\", \"output\", 0) = %q, should be as reg pattern %q", got, want)
}
})

View File

@ -1,13 +1,13 @@
#!/bin/sh
case "$1" in
"--version")
"-version")
echo convert: version fake
;;
esac
echo $@
if [ "$3" = "0" ] # quality parameter
if [ "$4" = "0" ] # quality parameter
then
exit -1
fi