@23g/cdn-helper 中文文档教程
@23g/cdn-helper
CDN helper
Installation
首先在你的项目中安装包。
npm install @23g/cdn-helper
或
yarn install @23g/cdn-helper
安装后确保在您的环境中使用 CDNIMAGEURL 或 MIX CDNIMAGE_URL(与 laravel 混合项目)设置为 CDN 的 url。
Usage
在我们的项目中,您可以使用接受 3 个参数的 cdn() 辅助函数:
import cdn from 'cdn-helper';
/**
* {String} path
* {String} dimensions | (width)x(height), w(width), h(height)
* {String} mode | crop is default, can be left empty
**/
cdn('/yoda.jpeg', '200x200', 'crop');
Resize options
“尺寸”参数中传递的可能调整大小选项如下:
Value | Action |
---|---|
(width)x(height) | Resize an image using both dimensions |
h(height) | To scale an image based on height |
w(width) | To scale an image based on width |
@23g/cdn-helper
CDN helper
Installation
First install the package in your project.
npm install @23g/cdn-helper
or
yarn install @23g/cdn-helper
After installing make sure in your environment CDNIMAGEURL or MIXCDNIMAGE_URL (with laravel mix projects) is set with the url to the CDN.
Usage
Within our project you can use the cdn() helper function which accepts 3 parameters:
import cdn from 'cdn-helper';
/**
* {String} path
* {String} dimensions | (width)x(height), w(width), h(height)
* {String} mode | crop is default, can be left empty
**/
cdn('/yoda.jpeg', '200x200', 'crop');
Resize options
The possibel resize options passed along in the "dimensions" param are as following:
Value | Action |
---|---|
(width)x(height) | Resize an image using both dimensions |
h(height) | To scale an image based on height |
w(width) | To scale an image based on width |
更多
你可能也喜欢
- 2rem 中文文档教程
- 46c-sector 中文文档教程
- 65710f05-a7c1-48d1-9ee5-acdfb7f70007 中文文档教程
- @2003scape/rsc-path-finder 中文文档教程
- @2stefant.org/alldays 中文文档教程
- @3fv/redis-cluster-monitor 中文文档教程
- @3kles/kles-footer 中文文档教程
- @3test/ethereum-asset-ledger 中文文档教程
- @42ndstudio/ckeditor5-build-inline-custom 中文文档教程
- @4geit/rct-register-component 中文文档教程