Línea 508... |
Línea 508... |
508 |
// $target_path = $storage->getPathKnowledgeArea(); // No longer needed directly here, composePathTo methods use storagePath internally
|
508 |
// $target_path = $storage->getPathKnowledgeArea(); // No longer needed directly here, composePathTo methods use storagePath internally
|
Línea 509... |
Línea 509... |
509 |
|
509 |
|
Línea 510... |
Línea 510... |
510 |
$storage->setFiles($request->getFiles()->toArray());
|
510 |
$storage->setFiles($request->getFiles()->toArray());
|
511 |
|
511 |
|
512 |
if($storage->setCurrentFilename('image')) {
|
512 |
if($storage->setCurrentFilename('image')) {
|
513 |
$tmp_filename = $storage->getTmpFilename();
|
513 |
$image_tmp_filename = $storage->getTmpFilename();
|
Línea 514... |
Línea 514... |
514 |
$filename = 'knowledge_image_' . $knowledgeAreaContent->uuid . '.' . $storage->getExtension();
|
514 |
$image_filename = 'knowledge_image_' . $knowledgeAreaContent->uuid . '.' . $storage->getExtension();
|
515 |
$storage->composePathToFilename(Storage::TYPE_KNOWLEDGE_AREA, $knowledgeAreaContent->uuid, $filename);
|
515 |
$image_target_filename = $storage->composePathToFilename(Storage::TYPE_KNOWLEDGE_AREA, $knowledgeAreaContent->uuid, $image_filename);
|
516 |
|
516 |
|
Línea 517... |
Línea 517... |
517 |
list($target_width_str, $target_height_str) = explode('x', $this->config['leaderslinked.image_sizes.knowledge_area']);
|
517 |
list($target_width_str, $target_height_str) = explode('x', $this->config['leaderslinked.image_sizes.knowledge_area']);
|
518 |
$target_width = (int)$target_width_str;
|
518 |
$target_width = (int)$target_width_str;
|
519 |
$target_height = (int)$target_height_str;
|
519 |
$target_height = (int)$target_height_str;
|
520 |
|
520 |
|
521 |
if (!$storage->uploadImageResize($tmp_filename, $filename, $target_width, $target_height)) {
|
521 |
if (!$storage->uploadImageResize($image_tmp_filename, $image_target_filename, $target_width, $target_height)) {
|
522 |
return new JsonModel([
|
522 |
return new JsonModel([
|
Línea 523... |
Línea 523... |
523 |
'success' => false,
|
523 |
'success' => false,
|
524 |
'data' => 'ERROR_IMAGE_UPLOAD'
|
524 |
'data' => 'ERROR_IMAGE_UPLOAD'
|
Línea 525... |
Línea 525... |
525 |
]);
|
525 |
]);
|
526 |
}
|
526 |
}
|
527 |
|
527 |
|
528 |
$knowledgeAreaContent->image = $filename;
|
528 |
$knowledgeAreaContent->image = $image_filename;
|
Línea 529... |
Línea 529... |
529 |
}
|
529 |
}
|
530 |
|
530 |
|
531 |
if($storage->setCurrentFilename('attachment')) {
|
531 |
if($storage->setCurrentFilename('attachment')) {
|
532 |
$tmp_filename = $storage->getTmpFilename();
|
532 |
$attachment_tmp_filename = $storage->getTmpFilename();
|
533 |
$filename = 'knowledge_attachment_' . $knowledgeAreaContent->uuid . '.' . $storage->getExtension();
|
533 |
$attachment_filename = 'knowledge_attachment_' . $knowledgeAreaContent->uuid . '.' . $storage->getExtension();
|
534 |
$storage->composePathToFilename(Storage::TYPE_KNOWLEDGE_AREA, $knowledgeAreaCategory->uuid, $filename);
|
534 |
$attachment_target_filename = $storage->composePathToFilename(Storage::TYPE_KNOWLEDGE_AREA, $knowledgeAreaContent->uuid, $attachment_filename);
|
Línea 535... |
Línea 535... |
535 |
|
535 |
|
536 |
if (!$storage->moveUploadedFile($tmp_filename, $filename)) {
|
536 |
if (!$storage->moveUploadedFile($attachment_tmp_filename, $attachment_target_filename)) {
|
Línea 537... |
Línea 537... |
537 |
return new JsonModel([
|
537 |
return new JsonModel([
|
538 |
'success' => false,
|
538 |
'success' => false,
|
539 |
'data' => 'ERROR_IMAGE_UPLOAD'
|
539 |
'data' => 'ERROR_IMAGE_UPLOAD'
|
Línea 559... |
Línea 559... |
559 |
'uuid' => $knowledgeAreaContent->uuid,
|
559 |
'uuid' => $knowledgeAreaContent->uuid,
|
560 |
'title' => $knowledgeAreaContent->title,
|
560 |
'title' => $knowledgeAreaContent->title,
|
561 |
'description' => $knowledgeAreaContent->description,
|
561 |
'description' => $knowledgeAreaContent->description,
|
562 |
'link' => $knowledgeAreaContent->link,
|
562 |
'link' => $knowledgeAreaContent->link,
|
563 |
'image' => $storage->getGenericImage($path, $knowledgeAreaContent->uuid, $knowledgeAreaContent->image),
|
563 |
'image' => $storage->getGenericImage($path, $knowledgeAreaContent->uuid, $knowledgeAreaContent->image),
|
564 |
'attachment' => $knowledgeAreaContent->attachment ? $storage->getGenericFile($path, $knowledgeAreaContent->uuid, $knowledgeAreaContent->attachment) : '',
|
564 |
'attachment' => $storage->getGenericFile($path, $knowledgeAreaContent->uuid, $knowledgeAreaContent->attachment),
|
565 |
'category' => $knowledgeAreaCategory->name,
|
565 |
'category' => $knowledgeAreaCategory->name,
|
566 |
'link_view' => '',
|
566 |
'link_view' => '',
|
567 |
'link_edit' => '',
|
567 |
'link_edit' => '',
|
568 |
'link_delete' => '',
|
568 |
'link_delete' => '',
|
569 |
];
|
569 |
];
|