|
11 | 11 | use RZ\Roadiz\Documents\Models\AdvancedDocumentInterface; |
12 | 12 | use RZ\Roadiz\Documents\Models\DocumentInterface; |
13 | 13 | use RZ\Roadiz\Documents\Models\HasThumbnailInterface; |
| 14 | +use RZ\Roadiz\Documents\Models\SizeableInterface; |
14 | 15 | use RZ\Roadiz\Documents\Renderer\RendererInterface; |
15 | 16 | use RZ\Roadiz\Documents\UrlGenerators\DocumentUrlGeneratorInterface; |
16 | 17 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
@@ -139,8 +140,11 @@ public function toArray(): array |
139 | 140 | $thumbnail80Url = $this->documentUrlGenerator->getUrl(); |
140 | 141 | $this->documentUrlGenerator->setOptions($previewOptions); |
141 | 142 | $editImageUrl = $this->documentUrlGenerator->getUrl(); |
142 | | - $editImageWidth = $this->document->getImageWidth(); |
143 | | - $editImageHeight = $this->document->getImageHeight(); |
| 143 | + |
| 144 | + if ($this->document instanceof SizeableInterface) { |
| 145 | + $editImageWidth = $this->document->getImageWidth(); |
| 146 | + $editImageHeight = $this->document->getImageHeight(); |
| 147 | + } |
144 | 148 | } |
145 | 149 |
|
146 | 150 | $embedFinder = $this->embedFinderFactory?->createForPlatform( |
@@ -171,8 +175,8 @@ public function toArray(): array |
171 | 175 | 'shortMimeType' => $this->document->getShortMimeType(), |
172 | 176 | 'thumbnail80' => $thumbnail80Url, |
173 | 177 | 'editImageUrl' => $editImageUrl, |
174 | | - 'editImageWidth' => $editImageWidth, |
175 | | - 'editImageHeight' => $editImageHeight, |
| 178 | + 'editImageWidth' => $editImageWidth ?? null, |
| 179 | + 'editImageHeight' => $editImageHeight ?? null, |
176 | 180 | 'originalHotspot' => $originalHotspot ?? null, |
177 | 181 | ]; |
178 | 182 | } |
|
0 commit comments