chore: complete update
This commit is contained in:
32
.archive/Media/Entities/ImageVariant.php
Normal file
32
.archive/Media/Entities/ImageVariant.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Media\Entities;
|
||||
|
||||
use App\Framework\Database\Attributes\Entity;
|
||||
|
||||
#[Entity(tableName: 'image_variants')]
|
||||
class ImageVariant
|
||||
{
|
||||
public function __construct(
|
||||
public ?int $id = null,
|
||||
public int $imageId = 0,
|
||||
public string $variant = '', // 'thumbnail', 'small', 'medium', 'large'
|
||||
public string $format = '', // 'jpg', 'webp', 'avif'
|
||||
public int $width = 0,
|
||||
public int $height = 0,
|
||||
public int $fileSize = 0,
|
||||
public string $filename = '',
|
||||
public \DateTimeImmutable $createdAt = new \DateTimeImmutable(),
|
||||
) {}
|
||||
|
||||
public function getFullPath(Image $image): string
|
||||
{
|
||||
return sprintf(
|
||||
'%s/%s/%s.%s',
|
||||
$image->getUploadDirectory(),
|
||||
$image->getFilePathPattern(),
|
||||
$this->variant,
|
||||
$this->format
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user