Closed migratingcub closed 2 years ago
Hi @migratingcub , thanks for using the cropper.
I can't reproduce this bug on my pc. Could you upload the original image you crop?
By the way, are you using server-side blazor?
Hi @migratingcub , thanks for using the cropper. I can't reproduce this bug on my pc. Could you upload the original image you crop? By the way, are you using server-side blazor?
Thanks for your reply! Yes, I am using server-side blazor.
Original image here:
Edit:
The sample project I'm using is here: https://github.com/Chronostasys/ServerSideCropperExample
Seems it's the same issue as https://github.com/Chronostasys/ServerSideCropperExample/issues/1 .
As it's a bug of ast.net core 6, I would recommend you to use client side version or turn back to dotnet 5.
Seems it's the same issue as Chronostasys/ServerSideCropperExample#1 . As it's a bug of ast.net core 6, I would recommend you to use client side version or turn back to dotnet 5.
I was able to get a workaround working with the following:
In the Blazor.Cropper Project, Cropper.razor.cs page,
protected override async Task OnParametersSetAsync()
{
// ommitted code
if (PureCSharpProcessing || string.IsNullOrEmpty(InputId) || (ext == "gif" && AnimeGifEnable))
{
byte[] buffer = new byte[resizedImageFile.Size];
// PREVIOUS CODE
//await resizedImageFile.OpenReadStream(100000000).ReadAsync(buffer);
// WORKAROUND
var fileContent = new StreamContent(resizedImageFile.OpenReadStream(1024 * 1024 * 15));
buffer = await fileContent.ReadAsByteArrayAsync();
// ommitted code
}
// ommitted code
}
Seems it's the same issue as Chronostasys/ServerSideCropperExample#1 . As it's a bug of ast.net core 6, I would recommend you to use client side version or turn back to dotnet 5.
I was able to get a workaround working with the following:
In the Blazor.Cropper Project, Cropper.razor.cs page,
protected override async Task OnParametersSetAsync() { // ommitted code if (PureCSharpProcessing || string.IsNullOrEmpty(InputId) || (ext == "gif" && AnimeGifEnable)) { byte[] buffer = new byte[resizedImageFile.Size]; // PREVIOUS CODE //await resizedImageFile.OpenReadStream(100000000).ReadAsync(buffer); // WORKAROUND var fileContent = new StreamContent(resizedImageFile.OpenReadStream(1024 * 1024 * 15)); buffer = await fileContent.ReadAsByteArrayAsync(); // ommitted code } // ommitted code }
Added this walkaround in 1.2.6. Thanks so much for giving the idea.
Seems it's the same issue as Chronostasys/ServerSideCropperExample#1 . As it's a bug of ast.net core 6, I would recommend you to use client side version or turn back to dotnet 5.
I was able to get a workaround working with the following: In the Blazor.Cropper Project, Cropper.razor.cs page,
protected override async Task OnParametersSetAsync() { // ommitted code if (PureCSharpProcessing || string.IsNullOrEmpty(InputId) || (ext == "gif" && AnimeGifEnable)) { byte[] buffer = new byte[resizedImageFile.Size]; // PREVIOUS CODE //await resizedImageFile.OpenReadStream(100000000).ReadAsync(buffer); // WORKAROUND var fileContent = new StreamContent(resizedImageFile.OpenReadStream(1024 * 1024 * 15)); buffer = await fileContent.ReadAsByteArrayAsync(); // ommitted code } // ommitted code }
Added this walkaround in 1.2.6. Thanks so much for giving the idea.
No problem! Happy to help :)
Hello,
I'm working on a project targeting .NET 6.0 and seeing the following after setting the Cropper ImageFile property to the uploaded file:
Here is my markup for the InputFile and Cropper
Here is where I'm setting the ImageFile
I tested this in the ServerSideCropperExample project that's available and confirmed that the issue exists there as well.
.NET 5.0![image](https://user-images.githubusercontent.com/12344790/173144358-649e1dba-ea35-4315-8780-72260567dbd2.png)
.NET 6.0![image](https://user-images.githubusercontent.com/12344790/173144415-9d27ffa0-490d-48a0-98d2-57e8ac3b4c75.png)