You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an entity that stores images in s3. This is how I modified my field:
ImageField::new('mainImage', 'Slika Poduzeća')
->setBasePath($this->getBaseUrlForS3())
->setUploadDir('') // Dummy - unused we use s3
->setRequired(false)
->setHelp('Glavna slika poduzeća/logo (opcionalno)')
->setUploadedFileNamePattern('[randomhash].[extension]') // Customize the pattern
->setFormTypeOption('upload_new', function (UploadedFile $file, string $uploadDir, string $fileName) {
$filePath = 'pages/' . $fileName;
$this->s3Service->uploadFile($file, $filePath);
return $filePath;
})
->setFormTypeOption('upload_delete', function (string $filePath) {
// Delete the file from S3 via S3Service
$this->s3Service->deleteFile($filePath);
})
->setFormTypeOption('mapped', true)
->setFormTypeOption('data_class', null) // Ensure that the field gets populated with the existing value
Saving works nicely, image is shown on both detail and list page, but when I click on edit, the image is not shown in the image field + if I just save then, it gets deleted like I removed it. Anyone able to tell me why and how to fix this?
The text was updated successfully, but these errors were encountered:
I have an entity that stores images in s3. This is how I modified my field:
Saving works nicely, image is shown on both detail and list page, but when I click on edit, the image is not shown in the image field + if I just save then, it gets deleted like I removed it. Anyone able to tell me why and how to fix this?
The text was updated successfully, but these errors were encountered: