[COMPONENT][Attachment][Entity][Attachment] getThumbnail can be null
This commit is contained in:
parent
2967b544f5
commit
bfec10fc95
@ -357,7 +357,7 @@ class Attachment extends Entity
|
||||
*
|
||||
* @return AttachmentThumbnail
|
||||
*/
|
||||
public function getThumbnail(?string $size = null, bool $crop = false): AttachmentThumbnail
|
||||
public function getThumbnail(?string $size = null, bool $crop = false): ?AttachmentThumbnail
|
||||
{
|
||||
return AttachmentThumbnail::getOrCreate(attachment: $this, size: $size, crop: $crop);
|
||||
}
|
||||
|
@ -185,10 +185,10 @@ class AttachmentEmbed extends Entity
|
||||
$thumbnail = $attachment->getThumbnail('medium');
|
||||
if (\is_null($attachment) || \is_null($attachment->getWidth()) || \is_null($attachment->getHeight())) {
|
||||
$attr['has_attachment'] = false;
|
||||
} else {
|
||||
} elseif (!\is_null($thumbnail)) {
|
||||
$attr['has_attachment'] = true;
|
||||
$attr['width'] = $thumbnail->getWidth();
|
||||
$attr['height'] = $thumbnail->getHeight();
|
||||
$attr['width'] = $thumbnail->getWidth();
|
||||
$attr['height'] = $thumbnail->getHeight();
|
||||
}
|
||||
return $attr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user