truonglv
Well-known member
- Affected version
- 2.1.0 b4
Hello.
In some case I have provide width & height to attachment data but it's not saved cause you have forced that fields for image only.
PHP:
$extra = [
'width' => $editor->getWidth(),
'height' => $editor->getHeight()
];
$tempFile = File::copyAbstractedPathToTempFile($path);
File::deleteFromAbstractedPath($path);
$file = new FileWrapper($tempFile, $fileName);
$handler->beforeNewAttachment($file, $extra);
$data = $attachmentPreparer->insertDataFromFile($file, \XF::visitor()->user_id, $extra);
In some case I have provide width & height to attachment data but it's not saved cause you have forced that fields for image only.
PHP:
$sourceFile = $file->getFilePath();
$width = $file->getImageWidth();
$height = $file->getImageHeight();