PHP code example of openstudio / page-builder-bundle
1. Go to this page and download the library: Download openstudio/page-builder-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use OpenStudio\PageBuilderBundle\Contract\ImageUploadPortInterface;
use OpenStudio\PageBuilderBundle\Contract\ImageLibraryPortInterface;
use OpenStudio\PageBuilderBundle\Dto\ImageUploadResponse;
use OpenStudio\PageBuilderBundle\Dto\ImageRecord;
final readonly class ImageUploadAdapter implements ImageUploadPortInterface
{
public function upload(UploadedFile $file, ?string $context = null, ?string $uploadedBy = null): ImageUploadResponse
{
// store $file, then return where it lives
return new ImageUploadResponse(id: '...', url: '...', originalFileName: $file->getClientOriginalName());
}
public function delete(string $imageId): void { /* ... */ }
}