Skip to content
Corex

WebpMeta

Corex\Media\WebpMeta · class · Add-ons layer

The tracked record for one CoreX-generated WebP derivative (spec 062): the original/generated paths + bytes, the size saving, dimensions, quality, a source hash, when it was generated, and the gate result (active_for_delivery + inactive_reason). Persisted in attachment meta (_corex_webp) so delivery can consult the gate and the reset command knows exactly which files are CoreX-generated (and never touches originals or untracked WebP). measure() reads the files (filesize/getimagesize/md5) and applies the gate.

__construct(string $originalPath, string $generatedPath, int $originalBytes, int $generatedBytes, float $saving, string $dimensions, int $quality, string $sourceHash, string $generatedAt, bool $activeForDelivery, string $inactiveReason)

Section titled “__construct(string $originalPath, string $generatedPath, int $originalBytes, int $generatedBytes, float $saving, string $dimensions, int $quality, string $sourceHash, string $generatedAt, bool $activeForDelivery, string $inactiveReason)”

measure(string $originalPath, string $generatedPath, int $quality, float $minSaving, ?string $generatedAt): self

Section titled “measure(string $originalPath, string $generatedPath, int $quality, float $minSaving, ?string $generatedAt): self”

Measure a freshly-generated derivative against its original and apply the {@see WebpGate}. The “generated_at” is injected so the result is deterministic in tests.