Cannot use object of type Laminas\Diactoros\UploadedFile as array
suiteshare opened this issue · 1 comments
CakePHP: 4.1
cakephp-upload: 5.0.0 RC2
league/flysystem-aws-s3-v3: ^1.0
In method addBehavior (transformer) get this erros on acesse $data['tmp_name'].
`
'transformer' => function ($table, $entity, $data, $field, $settings) use ($thumbSize, $pathName, $unique) {
$extension = pathinfo($data->getClientFilename(), PATHINFO_EXTENSION);
$tmp = tempnam(sys_get_temp_dir(), 'upload') . '.' . $extension;
$size = new \Imagine\Image\Box(40, 40);
$mode = \Imagine\Image\ImageInterface::THUMBNAIL_INSET;
$imagine = new \Imagine\Gd\Imagine();
$imagine->open($data['tmp_name'])
->thumbnail($size, $mode)
->save($tmp);
return [
$data['tmp_name'] => $data->getClientFilename(),
$tmp => 'thumbnail-' . $data->getClientFilename(),
];
},
`
In Cake 4 file uploads and hence $data
are instances of UploadedFileInterface
not PHP file arrays.