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
174
vendor/intervention/image/src/AnimationFactory.php
vendored
Normal file
174
vendor/intervention/image/src/AnimationFactory.php
vendored
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image;
|
||||
|
||||
use Error;
|
||||
use Intervention\Gif\DisposalMethod;
|
||||
use Intervention\Image\Exceptions\DecoderException;
|
||||
use Intervention\Image\Exceptions\FilesystemException;
|
||||
use Intervention\Image\Interfaces\AnimationFactoryInterface;
|
||||
use Intervention\Image\Interfaces\DriverInterface;
|
||||
use Intervention\Image\Interfaces\FrameInterface;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class AnimationFactory implements AnimationFactoryInterface
|
||||
{
|
||||
/**
|
||||
* Current frame number.
|
||||
*/
|
||||
protected int $currentFrameNumber = 0;
|
||||
|
||||
/**
|
||||
* Image sources of animation frames.
|
||||
*
|
||||
* @var array<mixed>
|
||||
*/
|
||||
protected array $sources = [];
|
||||
|
||||
/**
|
||||
* Frame delays of animation frames in seconds.
|
||||
*
|
||||
* @var array<float>
|
||||
*/
|
||||
protected array $delays = [];
|
||||
|
||||
/**
|
||||
* Frame processing call names.
|
||||
*
|
||||
* @var array<null|string>
|
||||
*/
|
||||
protected array $processingCalls = [];
|
||||
|
||||
/**
|
||||
* Frame processing arguments of calls.
|
||||
*
|
||||
* @var array<null|array<mixed>>
|
||||
*/
|
||||
protected array $processingArguments = [];
|
||||
|
||||
/**
|
||||
* Create new instance.
|
||||
*/
|
||||
public function __construct(
|
||||
protected int $width,
|
||||
protected int $height,
|
||||
null|callable $animation = null,
|
||||
) {
|
||||
if (is_callable($animation)) {
|
||||
$animation($this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see AnimationFactoryInterface::build()
|
||||
*/
|
||||
public static function build(
|
||||
int $width,
|
||||
int $height,
|
||||
callable $animation,
|
||||
DriverInterface $driver,
|
||||
): ImageInterface {
|
||||
return (new self($width, $height, $animation))->image($driver);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see AnimationFactoryInterface::add()
|
||||
*/
|
||||
public function add(mixed $source, float $delay = 1): AnimationFactoryInterface
|
||||
{
|
||||
$this->currentFrameNumber++;
|
||||
|
||||
$this->sources[$this->currentFrameNumber] = $source;
|
||||
$this->delays[$this->currentFrameNumber] = $delay;
|
||||
$this->processingCalls[$this->currentFrameNumber] = null;
|
||||
$this->processingArguments[$this->currentFrameNumber] = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see AnimationFactoryInterface::image()
|
||||
*/
|
||||
public function image(DriverInterface $driver): ImageInterface
|
||||
{
|
||||
if (count($this->sources) === 0) {
|
||||
return $driver->createImage($this->width, $this->height);
|
||||
}
|
||||
|
||||
$frames = array_map(
|
||||
$this->buildFrame(...),
|
||||
array_fill(0, count($this->sources), $driver),
|
||||
$this->sources,
|
||||
$this->delays,
|
||||
$this->processingCalls,
|
||||
$this->processingArguments,
|
||||
);
|
||||
|
||||
return new Image($driver, $driver->createCore($frames));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build frame from given image source and delay.
|
||||
*
|
||||
* @param null|array<mixed> $processingArguments
|
||||
*/
|
||||
private function buildFrame(
|
||||
DriverInterface $driver,
|
||||
mixed $source,
|
||||
float $delay,
|
||||
?string $processingCall = null,
|
||||
?array $processingArguments = null,
|
||||
): FrameInterface {
|
||||
try {
|
||||
// try to decode image source
|
||||
$image = $driver->decodeImage($source);
|
||||
} catch (DecoderException | FilesystemException) {
|
||||
// create empty image with colored background
|
||||
$image = $driver->createImage($this->width, $this->height)
|
||||
->fill($driver->decodeColor($source));
|
||||
}
|
||||
|
||||
// adjust size if necessary
|
||||
if ($image->width() !== $this->width || $image->height() !== $this->height) {
|
||||
$image->cover($this->width, $this->height);
|
||||
}
|
||||
|
||||
// apply processing call if available
|
||||
if ($processingCall !== null) {
|
||||
call_user_func_array([$image, $processingCall], $processingArguments);
|
||||
}
|
||||
|
||||
// return ready-made frame with all attributes
|
||||
return $image
|
||||
->core()
|
||||
->first()
|
||||
->setDelay($delay)
|
||||
->setDisposalMethod(DisposalMethod::BACKGROUND->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect processing calls on frame images.
|
||||
*
|
||||
* @param array<null|array<mixed>> $arguments
|
||||
* @throws Error
|
||||
*/
|
||||
public function __call(string $name, array $arguments): self
|
||||
{
|
||||
if (!method_exists(Image::class, $name)) {
|
||||
throw new Error('Call to undefined method ' . Image::class . '::' . $name . '()');
|
||||
}
|
||||
|
||||
$this->processingCalls[$this->currentFrameNumber] = $name;
|
||||
$this->processingArguments[$this->currentFrameNumber] = $arguments;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue