diff --git a/internal/config/config_raw.go b/internal/config/config_raw.go index 1e94c6974..ad097fb04 100644 --- a/internal/config/config_raw.go +++ b/internal/config/config_raw.go @@ -106,6 +106,11 @@ func (c *Config) HeifConvertBin() string { return findExecutable(c.options.HeifConvertBin, "heif-convert") } +// HeifConvertScript returns the heif-convert wrapper script name. +func (c *Config) HeifConvertScript() string { + return findExecutable("heif-convert.sh", "") +} + // HeifConvertEnabled checks if heif-convert is enabled for HEIF conversion. func (c *Config) HeifConvertEnabled() bool { return !c.DisableHeifConvert() diff --git a/internal/config/config_raw_test.go b/internal/config/config_raw_test.go index f6aba3945..44ea5f504 100644 --- a/internal/config/config_raw_test.go +++ b/internal/config/config_raw_test.go @@ -81,6 +81,13 @@ func TestConfig_HeifConvertBin(t *testing.T) { assert.Contains(t, bin, "/bin/heif-convert") } +func TestConfig_HeifConvertScript(t *testing.T) { + c := NewConfig(CliTestContext()) + + bin := c.HeifConvertScript() + assert.Contains(t, bin, "/bin/heif-convert.sh") +} + func TestConfig_HeifConvertEnabled(t *testing.T) { c := NewConfig(CliTestContext()) assert.True(t, c.HeifConvertEnabled()) diff --git a/internal/config/config_report.go b/internal/config/config_report.go index 35e263a50..2da975407 100644 --- a/internal/config/config_report.go +++ b/internal/config/config_report.go @@ -149,6 +149,7 @@ func (c *Config) Report() (rows [][]string, cols []string) { {"sips-bin", c.SipsBin()}, {"sips-blacklist", c.SipsBlacklist()}, {"heifconvert-bin", c.HeifConvertBin()}, + {"heifconvert-script", c.HeifConvertScript()}, {"ffmpeg-bin", c.FFmpegBin()}, {"ffmpeg-encoder", c.FFmpegEncoder().String()}, {"ffmpeg-bitrate", fmt.Sprintf("%d", c.FFmpegBitrate())}, diff --git a/internal/photoprism/convert_jpeg.go b/internal/photoprism/convert_jpeg.go index 740d3c402..1dcd43553 100644 --- a/internal/photoprism/convert_jpeg.go +++ b/internal/photoprism/convert_jpeg.go @@ -182,7 +182,11 @@ func (c *Convert) JpegConvertCommand(f *MediaFile, jpegName string, xmpName stri } else if f.IsVideo() && c.conf.FFmpegEnabled() { result = exec.Command(c.conf.FFmpegBin(), "-y", "-i", f.FileName(), "-ss", "00:00:00.001", "-vframes", "1", jpegName) } else if f.IsHEIF() && c.conf.HeifConvertEnabled() { - result = exec.Command(c.conf.HeifConvertBin(), f.FileName(), jpegName) + if scriptName := c.conf.HeifConvertScript(); scriptName != "" { + result = exec.Command(scriptName, f.FileName(), jpegName) + } else { + result = exec.Command(c.conf.HeifConvertBin(), f.FileName(), jpegName) + } } else { return nil, useMutex, fmt.Errorf("file type %s not supported", f.FileType()) }