BootstrapBlazor.ImageCropper
0.0.1
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package BootstrapBlazor.ImageCropper --version 0.0.1
NuGet\Install-Package BootstrapBlazor.ImageCropper -Version 0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BootstrapBlazor.ImageCropper" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BootstrapBlazor.ImageCropper --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BootstrapBlazor.ImageCropper, 0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BootstrapBlazor.ImageCropper as a Cake Addin #addin nuget:?package=BootstrapBlazor.ImageCropper&version=0.0.1 // Install BootstrapBlazor.ImageCropper as a Cake Tool #tool nuget:?package=BootstrapBlazor.ImageCropper&version=0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Blazor ImageCropper 图像裁剪 组件
基于Cropper.js
示例:
https://www.blazor.zone/ImageCroppers
https://blazor.app1.es/ImageCroppers
使用方法:
1.nuget包
BootstrapBlazor.ImageCropper
2._Imports.razor 文件 或者页面添加 添加组件库引用
@using BootstrapBlazor.Components
3.razor页面
<ImageCropper Url="./_content/DemoShared/icon-512.png" OnBase64Result="OnResult" />
@code{
Task OnResult(string base64)
{
Console.WriteLine(base64);
return Task.CompletedTask;
}
}
<ImageCropper @ref="cropper" Url="@images[0]" DefaultButton="false" />
<BootstrapInputGroup>
<Button Text="OK" OnClick="(async () => Base64 = await cropper.Crop())" />
<Button Text="复位" OnClick="cropper.Reset" />
<Button Text="替换" OnClick="(async () => {
index = index == 0 ? 1 : 0;
await cropper.Replace(images[index]);
})" />
</BootstrapInputGroup>
<br/>
<Textarea Value="@Base64" rows="3" />
@code{
ImageCropper? cropper;
string[] images = ["./_content/DemoShared/test.jpg", "./_content/DemoShared/icon-512.png"];
int index = 0;
string? Base64 { get; set; }
}
4.参数说明
类型 | 参数 | 说明 | 默认值 |
---|---|---|---|
string | Url | 图片URL/Base64 dataurl | |
string | ConfirmBtnTitle | 确认按钮文本 | OK |
string | ResetBtnTitle | 复位按钮文本 | 复位 |
string | PreviewTitle | 预览文本 | 预览 |
bool | DefaultButton | 显示默认按钮 | true |
bool | Preview | 显示剪裁后预览 | true |
Task<string> | Crop | 剪裁,返回 base64, 并执行 OnResult/OnBase64Result 回调 | |
Task<Stream> | CropToStream | 剪裁,返回 Stream | |
Task | Replace(string url) | 替换图片 | |
Task | SetDragMode(string? mode) | 更改拖动模式 | |
Task | Enable | 组件可用 | |
Task | Disable | 禁用组件 | |
Task | Reset | 复位图像 | |
Task | Clear | 清空图像 | |
Task | Destroy | 销毁 | |
Task | Rotate(int degree) | 旋转, 90, 180, 270, -90 ... | |
Func<Stream, Task> | OnResult | 剪裁结果 Stream 回调方法 | |
Func<string, Task> | OnBase64Result | 剪裁结果 base64 回调方法 | |
Func<string, Task>? | OnError | 错误回调 | |
string | CssClass | 自定义图片 CSS | null |
string | CssPath | 自定义CSS | null |
string | ModulePath | 自定义cropper.js路径 | null |
更新历史
Blazor 组件
AlexChow
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.AspNetCore.Components.Web (>= 6.0.0)
-
net7.0
- Microsoft.AspNetCore.Components.Web (>= 7.0.0)
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on BootstrapBlazor.ImageCropper:
Package | Downloads |
---|---|
BootstrapBlazor.Densen.All
Blazor 组件懒人包 |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on BootstrapBlazor.ImageCropper:
Repository | Stars |
---|---|
dotnetcore/BootstrapBlazor
Bootstrap Blazor is an enterprise-level UI component library based on Bootstrap and Blazor.
|
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 234 | 11/13/2024 |
9.0.0-beta02 | 74 | 11/7/2024 |
9.0.0-beta01 | 104 | 11/1/2024 |
8.3.0 | 194 | 10/27/2024 |
8.2.0 | 277 | 10/16/2024 |
8.1.0 | 173 | 10/12/2024 |
0.0.4 | 3,076 | 12/9/2023 |
0.0.3 | 133 | 12/8/2023 |
0.0.2 | 128 | 12/7/2023 |
0.0.1 | 117 | 12/7/2023 |