first
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user