Skip to content

Commit 7aa99b2

Browse files
committed
ISSUE-345: image data resource fix
1 parent 5ff1384 commit 7aa99b2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Domain/Model/Messaging/TemplateImage.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class TemplateImage implements DomainModel, Identity
2626
private ?string $filename = null;
2727

2828
#[ORM\Column(name: 'data', type: 'blob', nullable: true)]
29-
private ?string $data = null;
29+
private mixed $data = null;
3030

3131
#[ORM\Column(name: 'width', type: 'integer', nullable: true)]
3232
private ?int $width = null;
@@ -51,6 +51,11 @@ public function getFilename(): ?string
5151

5252
public function getData(): ?string
5353
{
54+
if (is_resource($this->data)) {
55+
rewind($this->data);
56+
return stream_get_contents($this->data);
57+
}
58+
5459
return $this->data;
5560
}
5661

@@ -84,7 +89,7 @@ public function setFilename(?string $filename): self
8489

8590
public function setData(?string $data): self
8691
{
87-
$this->data = $data;
92+
$this->data = $data !== null ? fopen('data://text/plain,' . $data, 'r') : null;
8893
return $this;
8994
}
9095

0 commit comments

Comments
 (0)