[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
|
* @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);
|
return AttachmentThumbnail::getOrCreate(attachment: $this, size: $size, crop: $crop);
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ class AttachmentEmbed extends Entity
|
||||||
$thumbnail = $attachment->getThumbnail('medium');
|
$thumbnail = $attachment->getThumbnail('medium');
|
||||||
if (\is_null($attachment) || \is_null($attachment->getWidth()) || \is_null($attachment->getHeight())) {
|
if (\is_null($attachment) || \is_null($attachment->getWidth()) || \is_null($attachment->getHeight())) {
|
||||||
$attr['has_attachment'] = false;
|
$attr['has_attachment'] = false;
|
||||||
} else {
|
} elseif (!\is_null($thumbnail)) {
|
||||||
$attr['has_attachment'] = true;
|
$attr['has_attachment'] = true;
|
||||||
$attr['width'] = $thumbnail->getWidth();
|
$attr['width'] = $thumbnail->getWidth();
|
||||||
$attr['height'] = $thumbnail->getHeight();
|
$attr['height'] = $thumbnail->getHeight();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user