+ protected function importAttachment(ZipExportAttachment $exportAttachment, Page $page, ZipExportReader $reader): Attachment
+ {
+ if ($exportAttachment->file) {
+ $file = $this->zipFileToUploadedFile($exportAttachment->file, $reader);
+ $attachment = $this->attachmentService->saveNewUpload($file, $page->id);
+ $attachment->name = $exportAttachment->name;
+ $attachment->save();
+ } else {
+ $attachment = $this->attachmentService->saveNewFromLink(
+ $exportAttachment->name,
+ $exportAttachment->link ?? '',
+ $page->id,
+ );
+ }
+
+ $this->references->addAttachment($attachment, $exportAttachment->id);
+
+ return $attachment;
+ }
+
+ protected function importImage(ZipExportImage $exportImage, Page $page, ZipExportReader $reader): Image
+ {
+ $file = $this->zipFileToUploadedFile($exportImage->file, $reader);
+ $image = $this->imageService->saveNewFromUpload(
+ $file,
+ $exportImage->type,
+ $page->id,
+ );
+
+ $this->references->addImage($image, $exportImage->id);
+
+ return $image;
+ }
+