Files
skjnldsv 1d780448e0 feat(preview): read AVIF through ImageMagick where libgd cannot
libgd carries AVIF only where the distribution built it against libavif.
Where it did not, ImageMagick often still can, and the server already
depends on it for HEIC.

The two are the same container with different codecs, which is what the
libvips author points out in h2non/imaginary#337: HEIF holds h265 for
HEIC and AV1 for AVIF, and ImageMagick reads both through libheif. So
HEIC's provider becomes a Heif base parameterised by the format it asks
ImageMagick for and the one it checks the build carries, and HEIC and
AVIFImagick are what is left of it.

Like the other ImageMagick providers this one is off until an admin
enables it, so libgd stays the default path and nothing changes for an
installation that never had the extension.

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
2026-09-19 08:59:19 +02:00

38 lines
666 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2018 ownCloud GmbH
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OC\Preview;
/**
* Creates a JPG preview of a HEIF file holding h265, using ImageMagick via
* the PECL extension.
*
* @package OC\Preview
*/
class HEIC extends Heif {
/**
* {@inheritDoc}
*/
#[\Override]
public function getMimeType(): string {
return '/image\/(x-)?hei(f|c)/';
}
#[\Override]
protected function formatHint(): string {
return 'heic';
}
#[\Override]
protected function queryFormat(): string {
return 'HEIC';
}
}