首页 > 解决方案 > filepond-plugin-image-size-metadata 配置

问题描述

我希望你一切都好,只是想知道是否有人成功设置了 filepond 图像大小元数据插件。

https://github.com/yoldar/filepond-plugin-image-size-metadata

文档有些欠缺,目前我已将 allowImageSizeMetadata 设置为 FilePond 组件的参数:

<FilePond
name={file}
files={file}
allowMultiple={false}
allowImageSizeMetadata={true}
server={null}                
instantUpload={false}
onupdatefiles={(fileItems) => onFileChange(fileItems)}
/>

我已在文件顶部导入,如下所示:

import { FilePond, registerPlugin } from 'react-filepond';

import 'filepond/dist/filepond.min.css';

import FilePondPluginImageSizeMetaData from 'filepond-plugin-image-size-metadata';
import FilePondPluginImageExifOrientation from 'filepond-plugin-image-exif-orientation';
import FilePondPluginImagePreview from 'filepond-plugin-image-preview';
import 'filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css';

但是当我在控制台中注销输出时,我没有看到任何额外的东西,我认为我应该像宽度和高度元数据一样。

谁能看到我可能遗漏的东西?

谢谢

标签: javascriptreactjsmetadatamulterfilepond

解决方案


我认为您需要注册它。

例如,请参阅图像预览插件文档中的代码片段。

import * as FilePond from 'filepond';
import FilePondPluginImagePreview from 'filepond-plugin-image-preview';
import 'filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css';

// Register the plugin <- this call
FilePond.registerPlugin(FilePondPluginImagePreview);

推荐阅读