Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7197eaebf2
commit
9c0f8de791
15771 changed files with 1564103 additions and 5 deletions
148
vendor/intervention/image/src/FileExtension.php
vendored
Normal file
148
vendor/intervention/image/src/FileExtension.php
vendored
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image;
|
||||
|
||||
use Error;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
use Intervention\Image\Exceptions\NotSupportedException;
|
||||
|
||||
enum FileExtension: string
|
||||
{
|
||||
case JPG = 'jpg';
|
||||
case JPEG = 'jpeg';
|
||||
case PJPG = 'pjpg';
|
||||
case PJPEG = 'pjpeg';
|
||||
case WEBP = 'webp';
|
||||
case AVIF = 'avif';
|
||||
case BMP = 'bmp';
|
||||
case GIF = 'gif';
|
||||
case PNG = 'png';
|
||||
case TIF = 'tif';
|
||||
case TIFF = 'tiff';
|
||||
case JP2 = 'jp2';
|
||||
case J2K = 'j2k';
|
||||
case JP2K = 'jp2k';
|
||||
case JPF = 'jpf';
|
||||
case JPM = 'jpm';
|
||||
case JPG2 = 'jpg2';
|
||||
case J2C = 'j2c';
|
||||
case JPC = 'jpc';
|
||||
case JPX = 'jpx';
|
||||
case HEIC = 'heic';
|
||||
case HEIF = 'heif';
|
||||
case JXL = 'jxl';
|
||||
case ICO = 'ico';
|
||||
|
||||
/**
|
||||
* Create file extension from given identifier.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public static function create(string|self|Format|MediaType $identifier): self
|
||||
{
|
||||
if ($identifier instanceof self) {
|
||||
return $identifier;
|
||||
}
|
||||
|
||||
if ($identifier instanceof Format) {
|
||||
try {
|
||||
return $identifier->fileExtension();
|
||||
} catch (NotSupportedException $e) {
|
||||
throw new InvalidArgumentException(
|
||||
'Unable to create file extension from "' . $identifier::class . '"',
|
||||
previous: $e,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($identifier instanceof MediaType) {
|
||||
try {
|
||||
return $identifier->fileExtension();
|
||||
} catch (NotSupportedException $e) {
|
||||
throw new InvalidArgumentException(
|
||||
'Unable to create file extension from "' . $identifier->value . '"',
|
||||
previous: $e,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$extension = self::from(strtolower($identifier));
|
||||
} catch (Error) {
|
||||
try {
|
||||
$extension = MediaType::from(strtolower($identifier))->fileExtension();
|
||||
} catch (Error | NotSupportedException) {
|
||||
throw new InvalidArgumentException('Unable to create file extension from "' . $identifier . '"');
|
||||
}
|
||||
}
|
||||
|
||||
return $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to create media type from given identifier and return null on failure.
|
||||
*/
|
||||
public static function tryCreate(string|self|Format|MediaType $identifier): ?self
|
||||
{
|
||||
try {
|
||||
return self::create($identifier);
|
||||
} catch (InvalidArgumentException) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the matching format for the current file extension.
|
||||
*/
|
||||
public function format(): Format
|
||||
{
|
||||
return match ($this) {
|
||||
self::JPEG,
|
||||
self::JPG,
|
||||
self::PJPEG,
|
||||
self::PJPG => Format::JPEG,
|
||||
self::WEBP => Format::WEBP,
|
||||
self::GIF => Format::GIF,
|
||||
self::PNG => Format::PNG,
|
||||
self::AVIF => Format::AVIF,
|
||||
self::BMP => Format::BMP,
|
||||
self::TIF,
|
||||
self::TIFF => Format::TIFF,
|
||||
self::JP2,
|
||||
self::JP2K,
|
||||
self::J2K,
|
||||
self::JPF,
|
||||
self::JPM,
|
||||
self::JPG2,
|
||||
self::J2C,
|
||||
self::JPC,
|
||||
self::JPX => Format::JP2,
|
||||
self::HEIC,
|
||||
self::HEIF => Format::HEIC,
|
||||
self::JXL => Format::JXL,
|
||||
self::ICO => Format::ICO,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Return media types for the current file extension.
|
||||
*
|
||||
* @return array<MediaType>
|
||||
*/
|
||||
public function mediaTypes(): array
|
||||
{
|
||||
return $this->format()->mediaTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first found media type for the current file extension.
|
||||
*
|
||||
* @throws NotSupportedException
|
||||
*/
|
||||
public function mediaType(): MediaType
|
||||
{
|
||||
return $this->format()->mediaType();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue