mirror of
https://github.com/nextcloud/server.git
synced 2026-10-07 19:51:40 +02:00
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>
42 lines
876 B
PHP
42 lines
876 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
namespace OC\Preview;
|
|
|
|
/**
|
|
* Creates a JPG preview of a HEIF file holding AV1, using ImageMagick via
|
|
* the PECL extension.
|
|
*
|
|
* The AVIF provider beside this one reads the format through libgd, which
|
|
* is where most installations will get it and which needs nothing enabled.
|
|
* This one is for a libgd built without libavif, on a server whose
|
|
* ImageMagick does carry the codec.
|
|
*
|
|
* @package OC\Preview
|
|
*/
|
|
class AVIFImagick extends Heif {
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
#[\Override]
|
|
public function getMimeType(): string {
|
|
return '/image\/avif/';
|
|
}
|
|
|
|
#[\Override]
|
|
protected function formatHint(): string {
|
|
return 'avif';
|
|
}
|
|
|
|
#[\Override]
|
|
protected function queryFormat(): string {
|
|
return 'AVIF';
|
|
}
|
|
}
|