24 lines
572 B
PHP
24 lines
572 B
PHP
<?php
|
|
|
|
namespace Application\Generator;
|
|
|
|
use Application\Generator\WebsiteObjectGenerator;
|
|
|
|
class Image extends WebsiteObjectGenerator
|
|
{
|
|
public function __construct(protected readonly string $seed)
|
|
{
|
|
parent::__construct($seed);
|
|
}
|
|
|
|
public function getImage(int $width = 1280, int $height = 720): array
|
|
{
|
|
return [
|
|
'src' => 'https://picsum.photos/seed/' . $this->seed . "/$width/$height",
|
|
'width' => $width,
|
|
'height' => $height,
|
|
'alt' => $this->getGenerator()->sentence(),
|
|
];
|
|
}
|
|
}
|