@bigbinary/neeto-image-uploader-frontend

中文文档
4.2.2发布于 2026/11/05UNLICENSEDTypeScriptESM + CJS近 30 天下载 4.3万

这个 neeto-image-uploader-nano 管理利多产品的资产。 纳米出口 @bigbinary/neeto-image-uploader-frontend 国家防范机制一揽子计划 neeto-image-uploader-engine 铁路发展引擎.

中文使用文档
文档目录7 节
  1. 发动机
  2. 安装
  3. 前端软件包
  4. 安装
  5. 构成部分
  6. 钩子
  7. 上传配置

需要图像加载器

这个 neeto-image-uploader-nano 管理利多产品的资产。 纳米 出口 @bigbinary/neeto-image-uploader-frontend 国家防范机制一揽子计划 neeto-image-uploader-engine 铁路发展引擎.

目录

用主机应用程序开发

发动机

该引擎用于管理利多产品的资产.

安装

  1. 将此行添加到您的应用程序的 Gemfile 中 :

    source "NEETO_GEM_SERVER_URL" do
       # ..existing gems
    
       gem 'neeto-image-uploader-engine'
    end
    
  2. 然后执行:

    bundle install
    
  3. 将此行添加到您的应用程序 config/routes.rb 文件 :

    mount NeetoImageUploaderEngine::Engine, at: "/neeto_image_uploader"
    
  4. 在环境变量中添加以下密钥(需要所有6个密钥):

    IMAGE_KIT_PUBLIC_KEY
    IMAGE_KIT_PRIVATE_KEY
    IMAGE_KIT_URL_ENDPOINT
    
    UNSPLASH_ACCESS_KEY #(for fetching images from unsplash)
    

前端软件包

安装

  1. 安装最新的 neeto-image-uploader-frontend 使用下列软件包 命令 :
    yarn add @bigbinary/neeto-image-uploader-frontend
    

构成部分

1. 联合国. AssetLibrary (单位:千美元)源代码(中文(简体) )

Asset library

道具

  • isOpen:一个布尔来指定模式是否打开.
  • onClose:当模式关闭时触发回调函数.
  • onUploadComplete: 当图像上传时触发回调函数 完成 。 .
  • uploadConfig: 图像上传的配置对象.

使用量

import React, { useState } from "react";
import { AssetLibrary } from "@bigbinary/neeto-image-uploader-frontend";

const App = () => {
  const [isAssetLibraryOpen, setIsAssetLibraryOpen] = useState(false);
  const [image, setImage] = useState({ url: TEST_IMAGE_SRC, signedId: "" });

  const handleUploadComplete = image => setImage(image);

  return (
    <AssetLibrary
      isOpen={isAssetLibraryOpen}
      onClose={() => setIsAssetLibraryOpen(false)}
      onUploadComplete={handleUploadComplete}
    />
  );
};

export default App;

2. 联合国. ImageUploader (单位:千美元)源代码(中文(简体) )

Image Uploader

道具

  • onUploadComplete: 当图像上传时触发回调函数 完成 。 .
  • className: 适用于组成部分的其他类别.
  • src: 初始显示的图像源 URL.
  • uploadConfig: 图像上传的配置对象.
  • fixedAspectRatio: 保持特定侧面比的选项 图像。 预期的输入格式为{高:数,宽:数}.
  • defaultImageSize: 设置图像初始裁剪大小的选项. 预期输入格式为{高:数,宽:数}.
  • isOptionsDisabled: 禁用已删除的下拉选项 显示图像,或上传新图像.
  • ref: 显示 upload(file) 程序启动方法 一个上传。 在组件外选择文件时有用(例如通过) 拖放画布上.

使用量

import React, { useState } from "react";
import { ImageUploader } from "@bigbinary/neeto-image-uploader-frontend";

const App = () => {
  const [isAssetLibraryOpen, setIsAssetLibraryOpen] = useState(false);
  const [image, setImage] = useState({ url: TEST_IMAGE_SRC, signedId: "" });

  const handleUploadComplete = image => setImage(image);

  return (
    <ImageUploader
      className="mb-8 h-52 w-80"
      key={image.url}
      src={image.url}
      onUploadComplete={handleUploadComplete}
    />
  );
};

export default App;

3个. BasicImageUploader (单位:千美元)源代码(中文(简体) )

道具

  • src: 初始显示的图像源 URL.
  • className: 适用于组成部分的其他类别.
  • imageFallbackProps: 被传递到图像与Fallback组件的道具.
  • onDrop: 当图像被丢弃或选中时触发回调函数 上传.
  • isDisabled: 一个布尔来指定上传器是否被禁用 .
  • onRemove: 点击"移除"按钮时触发了回调函数.

使用量

import React, { useState } from "react";
import { noop } from "neetocist";
import { BasicImageUploader } from "@bigbinary/neeto-image-uploader-frontend";

const App = () => {
  const [image, setImage] = useState({ url: TEST_IMAGE_SRC, signedId: "" });

  return (
    <BasicImageUploader
      className="h-52 w-80"
      src={image.url}
      uploadProgress={0}
      onDrop={noop}
      onRemove={() => setImage({ url: "", signedId: "" })}
    />
  );
};

export default App;

4.四. ImageForm (单位:千美元)源代码(中文(简体) )

道具

  • onChange: 当任何窗体字段发生变化时触发回调函数.
  • imageUploaderProps: 需要传递到图像 Upload 的额外道具 组件.
  • className: 适用于组成部分的其他类别.
  • names: 为窗体集成指定字段名称的对象 :
    • image:形式上图像字段的名称(如"properties.imageUrl")
    • height: 表格中高度字段的名称(例如"高")
    • alignment:格式中的对齐字段名称(如"对齐")
  • logoHeight: 指定标志滑动器高度限制的对象 :
    • default: 滑动器的默认高度值( 默认值: 64)
    • min: 滑动器最小高度值( 默认: 64)
    • max: 滑动器的最大高度值( 默认: 100)
  • logoSizeVariableName: CSS 用于控制标识大小的可变名称( 需要)
  • showAlignmentBlock:布尔以控制对齐块是否 显示( 默认: 真)
  • showAltTextBlock:布尔以控制备选文本输入块是否 显示( 默认: 真)
  • isLabelEnabled:布尔以控制标签是否在 图像上传块( 默认: 真)
  • entityName: 字符串以自定义标签中使用的实体名称, 占位符和工具提示(默认:"Logo")。 这允许主机应用程序 用自定义实体名称来覆盖已编码的“ Logo” 文本.

使用量

import { Formik } from "formik";
import { ImageForm } from "@bigbinary/neeto-image-uploader-frontend";

const App = () => {
  const handleUpdate = (fieldName, value) => {
    console.log(`Field ${fieldName} changed to:`, value);
  };

  return (
    <Formik
      initialValues={{
        properties: {
          imageUrl: "",
          height: 64,
          alignment: "left",
        },
        altText: "",
      }}
    >
      <ImageForm
        className="logo-form"
        imageUploaderProps={{ maxSize: 1048576 }}
        names={{
          image: "properties.imageUrl",
          height: "height",
          alignment: "alignment",
        }}
        logoSizeVariableName="--my-app-logo-size"
        entityName="Image"
        onChange={handleUpdate}
      />
    </Formik>
  );
};

export default App;

钩子

1. 联合国. useImageUpload (单位:千美元)源代码(中文(简体) )

  • 这个 useImageUpload 钩子是一个反应自定义钩子,可以简化进程 在应用程序中上传图像。 它既处理开发,又处理开发 生产情景,跟踪上传进度,并提供干净的界面 用于图像上传.
  • 使用情况 需要认证。 。 。 .

回返

  • uploadImage: 启动图像上传的函数 。 它需要两个参数:
    • file: 要上传的图像文件 .
    • onUploadComplete: 上传完成后调用回调函数 .
  • uploadProgress: 数字代表上传进度(0-100).
  • isUploading:布尔表示上传是否在进行中.

使用量

导入钩子
import { useImageUpload } from "@bigbinary/neeto-image-uploader-frontend";
打开钩子
const { uploadImage, uploadProgress, isUploading } = useImageUpload();
调用上传图像
const handleImageUpload = async file => {
  uploadImage(file, uploadedImageData => {
    // Handle the uploaded image data
  });
};

上传配置

"Upload Config"一节描述了默认上传配置. 这个 配置可以通过通过 uploadConfig 道具 (英语).

{
  "maxImageSize": globalProps.endUserUploadedFileSizeLimitInMb,
  "allowedImageTypes": {
    "image/png": [".png"],
    "image/jpg": [".jpg", ".jpeg"],
    "image/gif": [".gif"],
    "image/svg+xml": [".svg"]
  }
}

示例: 覆盖上传配置 需要论坛。 。 。 .

密钥

  • maxImageSize: 允许上传图像的最大大小 .
  • allowedImageTypes: 指定允许的图像类型及其 相应的文件扩展名.

出版指令

咨询 构建和释放软件包 关于如何出版的详细指南.

版本与发布记录

@bigbinary/neeto-image-uploader-frontend 共发布 189 个版本,首次发布于 2023/04/05;过去 12 个月发布了 74 个版本。

版本发布日期距今
4.2.2latest2026/11/053 天前
4.2.12026/11/053 天前
4.2.02026/11/035 天前
4.1.162026/11/026 天前
4.1.152026/11/026 天前
4.1.15-beta1beta2026/11/026 天前

关于 @bigbinary/neeto-image-uploader-frontend 的常见问题

@bigbinary/neeto-image-uploader-frontend 是什么?

这个 neeto-image-uploader-nano 管理利多产品的资产。 纳米出口 @bigbinary/neeto-image-uploader-frontend 国家防范机制一揽子计划 neeto-image-uploader-engine 铁路发展引擎.

如何安装 @bigbinary/neeto-image-uploader-frontend?

在项目目录运行 npm install @bigbinary/neeto-image-uploader-frontend,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:qs(6.16.2)、url(0.11.4)、yup(0.32.11)、antd(5.22.1)、util(^0.12.5)、axios(1.20.0)、ramda(0.29.0)、react(18.3.1)、buffer(^6.0.3)、formik(2.4.6)、i18next(22.5.1)、zustand(4.4.2)、dompurify(3.4.17)、js-logger(1.6.1)、react-dom(18.3.1)、classnames(2.5.1)、react-query(3.39.3)、stream-http(3.2.0)、tailwindcss(4.1.16)、lucide-react(1.57.0)、react-helmet(^6.1.0)、os-browserify(0.3.0)、react-i18next(12.3.1)、vm-browserify(1.1.2)、@babel/runtime(7.29.7)、react-dropzone(14.3.8)、react-toastify(8.0.2)、tty-browserify(0.0.1)、path-browserify(^1.0.1)、https-browserify(1.0.0)、mixpanel-browser(2.46.0)、react-router-dom(5.3.3)、crypto-browserify(3.12.1)、source-map-loader(4.0.1)、stream-browserify(^3.0.0)、@bigbinary/neetoui(8.8.3)、@honeybadger-io/js(6.10.1)、@rails/activestorage(7.0.8-3)、@bigbinary/neeto-cist(1.0.17)、@honeybadger-io/react(6.1.25)、@tanstack/react-query(5.59.20)、@bigbinary/neeto-atoms(1.1.6)、@bigbinary/neeto-icons(1.20.89)、@bigbinary/neeto-molecules(5.12.0)、@tailwindcss/container-queries(0.1.1)、@bigbinary/neeto-editor-frontend(2.5.0)、@bigbinary/neeto-commons-frontend(4.15.0)、@bigbinary/neeto-filters-frontend(4.7.1)、@bigbinary/neeto-team-members-frontend(5.3.4)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bigbinary/neeto-image-uploader-frontend 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bigbinary/neeto-image-uploader-frontend 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@bigbinary/neeto-image-uploader-frontend 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.13。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@bigbinary/neeto-image-uploader-frontend 可以商用吗?

@bigbinary/neeto-image-uploader-frontend 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@bigbinary/neeto-image-uploader-frontend 的下载量有多少?

根据 npm 官方下载统计,@bigbinary/neeto-image-uploader-frontend 在 2026/10/08 – 2026/11/06 这 30 天内被下载 42,657 次,日均约 1,422 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bigbinary/neeto-image-uploader-frontend 还在维护吗?

最新版本 4.2.2 发布于 2026/11/05(3 天前);至今共发布 189 个版本,其中过去 12 个月发布了 74 个;首次发布于 2023/04/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。