This commit is contained in:
2025-06-18 14:50:18 +03:00
parent a64ed080bb
commit 4c716a8a8c
160 changed files with 6786 additions and 23 deletions

View File

@ -94,12 +94,22 @@ class PhotoModule extends Module
return substr($photoStr, 0, -1);
}
public function getItem(string $entity, string $entity_id): string
public function getItem(string $entity, string $entity_id, array $params = []): string
{
$photos = Photo::where("entity", $entity)->where("entity_id", $entity_id)->get();
$photoStr = "";
if (isset($params['width'])){
$w = $params['width'];
$style = "width: $w;";
}
elseif(isset($params['cover'])) {
$style = "width: 100%; height: 100%; object-fit: cover;";
}
else {
$style = "width: 150px;";
}
foreach ($photos as $photo) {
$photoStr .= "<img src='$photo->image' width='150px'>" . " ";
$photoStr .= "<img src='$photo->image' style='$style'>" . " ";
}
return substr($photoStr, 0, -1);