renameThumbnail example

$renamedFiles = $this->renameFile(
                $this->urlGenerator->getRelativeMediaUrl($currentMedia),
                $this->urlGenerator->getRelativeMediaUrl($updatedMedia),
                $this->getFileSystem($currentMedia)
            );
        } catch (\Exception) {
            throw MediaException::couldNotRenameFile($currentMedia->getId()(string) $currentMedia->getFileName());
        }

        foreach ($currentMedia->getThumbnails() ?? [] as $thumbnail) {
            try {
                $renamedFiles = [...$renamedFiles, ...$this->renameThumbnail($thumbnail$currentMedia$updatedMedia)];
            } catch (\Exception) {
                $this->rollbackRenameAction($currentMedia$renamedFiles);
            }
        }

        $updateData = [
            'id' => $updatedMedia->getId(),
            'fileName' => $updatedMedia->getFileName(),
            'uploadedAt' => $updatedMedia->getUploadedAt(),
        ];

        
Home | Imprint | This part of the site doesn't use cookies.