Skip to content

Conversation

@ildyria
Copy link
Member

@ildyria ildyria commented Dec 26, 2025

Fixes #1790

Summary by CodeRabbit

Release Notes

  • New Features
    • Added support for the AVIF image format. Users can now upload, process, and work with AVIF files seamlessly across the platform. The system provides full file recognition, proper MIME type handling, and maintains complete compatibility with all existing image processing features and workflows, giving users access to this modern image format.

✏️ Tip: You can customize this high-level summary in your review settings.

@ildyria ildyria requested a review from a team as a code owner December 26, 2025 22:39
@coderabbitai
Copy link

coderabbitai bot commented Dec 26, 2025

📝 Walkthrough

Walkthrough

This pull request adds AVIF image format support to the FileExtensionService by updating five related constants to recognize AVIF as a supported image format, including file extension mapping, MIME type recognition, and PHP EXIF type compatibility.

Changes

Cohort / File(s) Summary
AVIF Format Support
app/Services/Image/FileExtensionService.php
Added AVIF recognition across five constants: SUPPORTED_PHP_EXIF_IMAGE_TYPES (IMAGETYPE_AVIF), SUPPORTED_IMAGE_FILE_EXTENSIONS ('.avif'), SUPPORTED_IMAGE_MIME_TYPES ('image/avif'), MIME_TYPES_TO_FILE_EXTENSIONS ('image/avif' => '.avif'), and SUPPORTED_VIDEO_MIME_TYPES ('image/avif')

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A format so bright, AVIF takes flight,
Five constants aligned, the support's just right,
From extensions to types, the mapping's all set,
Hop forward we go, no rabbit regret! 🥕✨

Pre-merge checks

✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 77c6135 and 87fc3c5.

📒 Files selected for processing (1)
  • app/Services/Image/FileExtensionService.php
🧰 Additional context used
📓 Path-based instructions (1)
**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.php: Any new PHP file should contain the license header and have a single blank line after the opening PHP tag
Variable names should be in snake_case in PHP
Apply the PSR-4 coding standard in PHP
Use in_array() with true as the third parameter in PHP
Only use booleans in if statements, not integers or strings
Use strict comparison (===) instead of loose comparison (==)
Avoid code duplication in both if and else statements
Do not use empty() in PHP
Use the moneyphp/money library for handling monetary values in PHP
Never use floats or doubles to represent monetary values; use integers representing the smallest currency unit (e.g., cents for USD)

**/*.php: Write or extend executable specifications (unit, behaviour, or scenario tests) ahead of implementation, confirm they fail, and then drive code to green before refactoring. List the expected success, validation, and failure branches and add thin failing tests for each path.
For PHP code, adhere to conventions: license headers in new files, strict comparison (===), no empty(), in_array() with third parameter true, snake_case variables, PSR-4 standard, test base classes (AbstractTestCase for Unit, BaseApiWithDataTest for Feature_v2).
Always run phpunit tests. If a test remains red, disable it with a TODO, note the reason, and capture the follow-up in the relevant plan.
Spotless now uses Palantir Java Format 2.78.0 with a 120-character wrap; configure IDE formatters to match before pushing code changes.
Keep each increment's control flow flat by delegating validation/normalisation into tiny pure helpers that return simple enums or result records, then compose them instead of introducing inline branching that inflates the branch count per change.
When introducing new helpers/utilities or editing files prone to style violations (records, DTOs, generated adapters), run the narrowest applicable lint target (for example phpstan) before the full pipeline. Note the command in the related plan/task.
For PHP changes, ru...

Files:

  • app/Services/Image/FileExtensionService.php
🔇 Additional comments (6)
app/Services/Image/FileExtensionService.php (6)

25-32: LGTM!

The .avif extension is correctly added following the established pattern with lowercase and leading dot.


45-51: LGTM!

The image/avif MIME type is correctly added following the established pattern.


67-84: LGTM!

The MIME type to file extension mapping for AVIF is correctly added following the established pattern.


53-65: AI summary inconsistency: AVIF not added to video MIME types.

The AI-generated summary claims that 'image/avif' was added to SUPPORTED_VIDEO_MIME_TYPES, but the code shows no such change. This constant only contains video MIME types, which is correct. The summary is inaccurate.


17-23: The changes are compatible with the project's PHP version requirement. The composer.json specifies ^8.4 (PHP 8.4 or higher), which exceeds the minimum PHP 8.1 where IMAGETYPE_AVIF was introduced. No critical issue exists regarding PHP compatibility.

Ensure the following coding guidelines are applied before committing:

  • Write failing tests first, then drive the code to green
  • Run vendor/bin/php-cs-fixer fix to apply PHP code style fixes
  • Run make phpstan to verify PHPStan level 6 compliance
  • Run php artisan test to ensure all tests pass

17-23: Verify AVIF support in your deployment environment.

PHP GD, ImageMagick, and ExifTool all support AVIF, but require proper compilation:

  • PHP GD: Requires libavif (≥0.8.2) and --with-avif build flag
  • ImageMagick: Requires AVIF/HEIF delegates (libheif ≥1.7.0, recommend ≥1.15 for stability)
  • ExifTool: Supports AVIF metadata read/write

Ensure your deployment environment has these dependencies compiled in before using AVIF in production.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/Services/Image/FileExtensionService.php (1)

17-84: Add tests for AVIF support.

According to the coding guidelines, tests should be written for the new functionality. Please add tests covering:

  • AVIF file extension recognition (isSupportedImageFileExtension)
  • AVIF MIME type validation (isSupportedImageMimeType)
  • AVIF EXIF type support (hasSupportedExifImageType)
  • MIME type to extension mapping for AVIF

Run php artisan test to ensure all tests pass before committing.

As per coding guidelines, executable specifications should be written ahead of implementation to drive development.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 77c6135 and 87fc3c5.

📒 Files selected for processing (1)
  • app/Services/Image/FileExtensionService.php
🧰 Additional context used
📓 Path-based instructions (1)
**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.php: Any new PHP file should contain the license header and have a single blank line after the opening PHP tag
Variable names should be in snake_case in PHP
Apply the PSR-4 coding standard in PHP
Use in_array() with true as the third parameter in PHP
Only use booleans in if statements, not integers or strings
Use strict comparison (===) instead of loose comparison (==)
Avoid code duplication in both if and else statements
Do not use empty() in PHP
Use the moneyphp/money library for handling monetary values in PHP
Never use floats or doubles to represent monetary values; use integers representing the smallest currency unit (e.g., cents for USD)

**/*.php: Write or extend executable specifications (unit, behaviour, or scenario tests) ahead of implementation, confirm they fail, and then drive code to green before refactoring. List the expected success, validation, and failure branches and add thin failing tests for each path.
For PHP code, adhere to conventions: license headers in new files, strict comparison (===), no empty(), in_array() with third parameter true, snake_case variables, PSR-4 standard, test base classes (AbstractTestCase for Unit, BaseApiWithDataTest for Feature_v2).
Always run phpunit tests. If a test remains red, disable it with a TODO, note the reason, and capture the follow-up in the relevant plan.
Spotless now uses Palantir Java Format 2.78.0 with a 120-character wrap; configure IDE formatters to match before pushing code changes.
Keep each increment's control flow flat by delegating validation/normalisation into tiny pure helpers that return simple enums or result records, then compose them instead of introducing inline branching that inflates the branch count per change.
When introducing new helpers/utilities or editing files prone to style violations (records, DTOs, generated adapters), run the narrowest applicable lint target (for example phpstan) before the full pipeline. Note the command in the related plan/task.
For PHP changes, ru...

Files:

  • app/Services/Image/FileExtensionService.php
🔇 Additional comments (6)
app/Services/Image/FileExtensionService.php (6)

25-32: LGTM!

The .avif extension is correctly added following the established pattern with lowercase and leading dot.


45-51: LGTM!

The image/avif MIME type is correctly added following the established pattern.


67-84: LGTM!

The MIME type to file extension mapping for AVIF is correctly added following the established pattern.


53-65: AI summary inconsistency: AVIF not added to video MIME types.

The AI-generated summary claims that 'image/avif' was added to SUPPORTED_VIDEO_MIME_TYPES, but the code shows no such change. This constant only contains video MIME types, which is correct. The summary is inaccurate.


17-23: The changes are compatible with the project's PHP version requirement. The composer.json specifies ^8.4 (PHP 8.4 or higher), which exceeds the minimum PHP 8.1 where IMAGETYPE_AVIF was introduced. No critical issue exists regarding PHP compatibility.

Ensure the following coding guidelines are applied before committing:

  • Write failing tests first, then drive the code to green
  • Run vendor/bin/php-cs-fixer fix to apply PHP code style fixes
  • Run make phpstan to verify PHPStan level 6 compliance
  • Run php artisan test to ensure all tests pass

17-23: Verify AVIF support in your deployment environment.

PHP GD, ImageMagick, and ExifTool all support AVIF, but require proper compilation:

  • PHP GD: Requires libavif (≥0.8.2) and --with-avif build flag
  • ImageMagick: Requires AVIF/HEIF delegates (libheif ≥1.7.0, recommend ≥1.15 for stability)
  • ExifTool: Supports AVIF metadata read/write

Ensure your deployment environment has these dependencies compiled in before using AVIF in production.

@codecov
Copy link

codecov bot commented Dec 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.30%. Comparing base (a772a9e) to head (87fc3c5).
⚠️ Report is 5 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria merged commit 162dab4 into master Dec 26, 2025
39 checks passed
@ildyria ildyria deleted the add-avif-support branch December 26, 2025 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Support to the AVIF format

2 participants