Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ProcessMaker/ImportExport/Exporters/MediaExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,22 @@ public function import(): bool

$ref = $this->getReference(DependentType::MEDIA);
if ($ref && isset($ref['base64'])) {
$this->model->model->addMediaFromBase64($ref['base64'])
$newMedia = $this->model->model->addMediaFromBase64($ref['base64'])
->usingFileName($this->model->file_name)
->withCustomProperties($this->model->custom_properties)
->toMediaCollection($this->model->collection_name);

if (hasPackage('package-ai')) {
$updaterClass = 'ProcessMaker\\Package\\PackageAi\\Services\\FlowGenieMediaConfigUpdater';
if (class_exists($updaterClass)) {
$updaterClass::updateForMediaImport(
(string) $this->model->model_type,
(int) $this->model->model_id,
(int) $this->model->id,
(int) $newMedia->id
);
}
}
}

// We should delete the model, because the Spatie library recreates it.
Expand Down
Loading