mirror of
https://github.com/nextcloud/server.git
synced 2026-10-04 17:58:59 +02:00
libgd reads AVIF wherever the distribution built it against libavif, and exif_imagetype() has reported IMAGETYPE_AVIF since PHP 8.2, below the 8.3 this server requires. Both were missing from OC\Image, so an AVIF had no thumbnail anywhere: the Files grid showed a generic icon for a photo. The provider is enabled by default alongside the other formats libgd reads, and guarded by imagetypes() the way WebP is, so a build without libavif logs and falls through rather than failing. Imaginary is deliberately left alone. The shipped aio-imaginary answers 406 Unsupported media type for an AVIF while handling HEIC from the same container, so routing AVIF to it would replace a working preview with a failing one. Writing is added beside reading. An image loaded as AVIF would otherwise fall to the default branch of the output switch and be written as a PNG under whatever name the caller chose. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
21 lines
322 B
PHP
21 lines
322 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;
|
|
|
|
class AVIF extends Image {
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
#[\Override]
|
|
public function getMimeType(): string {
|
|
return '/image\/avif/';
|
|
}
|
|
}
|