@cloudinary/ng

中文文档
2.1.6发布于 2026/02/12TypeScriptESM + CJS近 30 天下载 9932

Cloudinary Angular SDK ========================= ## About The Cloudinary Angular SDK allows you to quickly and easily integrate your application with Cloudinary. Effortlessly optimize and transform your cloud's assets.

原始使用文档
文档目录17 节
  1. About
  2. Table of Contents
  3. Key Features
  4. Version Support
  5. Installation
  6. Install using your favorite package manager (yarn, npm)
  7. Usage
  8. Setup
  9. Transform and Optimize Assets
  10. Generate Image and Video HTML Tags
  11. Advanced Plugin Features
  12. File upload
  13. Contributions
  14. Get Help
  15. About Cloudinary
  16. Additional Resources
  17. License

Cloudinary Angular SDK

About

The Cloudinary Angular SDK allows you to quickly and easily integrate your application with Cloudinary. Effortlessly optimize and transform your cloud's assets.

Note

This Readme provides basic installation and usage information. For the complete documentation, see the Angular SDK Reference.

Table of Contents

Key Features

Version Support

SDK Versionng 10.0ng 11.0ng 12.0ng 13.0ng 14.0ng 15.0ng 16.0 & up
1.x.xVVVVVV
2.x.xVVVVV

New features will only be added to version 2.x.

Installation

Install using your favorite package manager (yarn, npm)

npm i @cloudinary/url-gen @cloudinary/ng --save

Or

yarn add @cloudinary/url-gen @cloudinary/angular --save

Usage

Setup

// In your app.module.ts:

// Import the CloudinaryModule.
import {CloudinaryModule} from '@cloudinary/ng';

imports: [
  ...,
  CloudinaryModule
],

Transform and Optimize Assets

import {CloudinaryImage} from '@cloudinary/url-gen/assets/CloudinaryImage';

export class AppComponent implements OnInit{
  img: CloudinaryImage;

  ngOnInit() {
     const myCld = new Cloudinary({ cloudName: 'demo'});
     this.img = myCld().image('sample');
  }
}

In your view add the component with your transformation

<advanced-image [cldImg]="this.img"></advanced-image>

Generate Image and Video HTML Tags

- Use <advanced-image> to generate image tags
- Use <advanced-video> to generate video tags

Advanced Plugin Features

import { CloudinaryImage } from "@cloudinary/url-gen";
import {
  lazyload,
  responsive,
  accessibility,
  placeholder
} from "@cloudinary/ng";

export class AppComponent {
  cloudinaryImage = new CloudinaryImage("sample", { cloudName: "demo" });
  plugins = [lazyload(),responsive(), accessibility(), placeholder()];
}
<advanced-image [cldImg]="cloudinaryImage" [plugins]="plugins">

You can omit any plugin, but the order from above should remain.

File upload

This SDK does not provide file upload functionality, however there are several methods of uploading from the client side.

Contributions

  • Ensure tests run locally (npm run test)
  • Open a PR and ensure GitHub actions tests pass

Get Help

If you run into an issue or have a question, you can either:

About Cloudinary

Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive and personalized visual-media experiences—irrespective of the viewing device.

Additional Resources

License

Released under the MIT license.

版本与发布记录

@cloudinary/ng 共发布 31 个版本,首次发布于 2021/12/06;过去 12 个月发布了 1 个版本。

版本发布日期距今
2.1.6latest2026/02/128 个月前
2.1.52025/05/141.5 年前
2.1.42025/05/141.5 年前
2.1.32025/05/121.5 年前
2.1.22025/02/251.7 年前
2.1.12024/11/142 年前

其他发布通道:beta → 1.0.0-beta.14,rc → 2.0.0-rc.0。

关于 @cloudinary/ng 的常见问题

@cloudinary/ng 是什么?

Cloudinary Angular SDK ========================= ## About The Cloudinary Angular SDK allows you to quickly and easily integrate your application with Cloudinary. Effortlessly optimize and transform your cloud's assets.

如何安装 @cloudinary/ng?

在项目目录运行 npm install @cloudinary/ng,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/core(>=12.0.0)、@angular/common(>=12.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cloudinary/ng 支持 TypeScript 吗?

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

@cloudinary/ng 支持 ESM 还是 CommonJS?

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

@cloudinary/ng 可以商用吗?

@cloudinary/ng 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@cloudinary/ng 的下载量有多少?

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

@cloudinary/ng 还在维护吗?

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