Update to magick 7 in alpine. (#1035)
This commit is contained in:
parent
85c1e52b06
commit
6e1e1d12ce
|
@ -37,17 +37,17 @@ func newMagickWorker() *MagickWorker {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
path, err := exec.LookPath("convert")
|
path, err := exec.LookPath("magick")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Executable worker not found: ImageMagick convert")
|
log.Println("Executable worker not found: magick")
|
||||||
} else {
|
} else {
|
||||||
version, err := exec.Command(path, "--version").Output()
|
version, err := exec.Command(path, "-version").Output()
|
||||||
if err != nil {
|
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
|
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{
|
return &MagickWorker{
|
||||||
path: path,
|
path: path,
|
||||||
|
@ -93,6 +93,7 @@ func (worker *FfmpegWorker) IsInstalled() bool {
|
||||||
|
|
||||||
func (worker *MagickWorker) EncodeJpeg(inputPath string, outputPath string, jpegQuality int) error {
|
func (worker *MagickWorker) EncodeJpeg(inputPath string, outputPath string, jpegQuality int) error {
|
||||||
args := []string{
|
args := []string{
|
||||||
|
"convert",
|
||||||
inputPath,
|
inputPath,
|
||||||
"-quality", fmt.Sprintf("%d", jpegQuality),
|
"-quality", fmt.Sprintf("%d", jpegQuality),
|
||||||
outputPath,
|
outputPath,
|
||||||
|
|
|
@ -49,7 +49,7 @@ func TestMagickWorker(t *testing.T) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("MagickCli.EncodeJpeg(\"input\", \"output\", 0) = nil, should be an error.")
|
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)
|
t.Errorf("MagickCli.EncodeJpeg(\"input\", \"output\", 0) = %q, should be as reg pattern %q", got, want)
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -1,13 +1,13 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"--version")
|
"-version")
|
||||||
echo convert: version fake
|
echo convert: version fake
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo $@
|
echo $@
|
||||||
if [ "$3" = "0" ] # quality parameter
|
if [ "$4" = "0" ] # quality parameter
|
||||||
then
|
then
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
Loading…
Reference in New Issue