Git Product home page Git Product logo

blazor.cropper's Introduction

Blazor.Cropper

Codacy Badge GitHub Nuget

A blazor library provide a component to crop image
=>

Sample site here
It is:

  • almost full c#
  • fast
  • mobile compatible
  • lighweight
  • support proportion
  • GIF crop support(only for small files)
  • support maui(blazor)
  • open source on github

If you find Blazor.Cropper helpful, you could star this repo, it's really important to me.

For a long time, crop image in blazor bother me a lot. That's why I tried to implement a cropper in blazor.

Users

  • CnGal CnGal是一个非营利性的,立志于收集整理国内制作组创作的中文Galgame/AVG的介绍、攻略、评测、感想等内容的资料性质的网站。

Maui Usage (new)

Blazor.Cropper now supports maui(blazor)!
In some platforms, you may need to use FilePicker to get the input image rather than using html input element. You can find details in the maui sample project

dotnet 6 changes

Although most of apis remains the same, there're some new apis which provide better performance in .Net 6.
In dotnet 5, using ImageCroppedResult.GetBase64Async(); to get the base64 result is fine. In dotnet 6, it should be replaced with ImageCroppedResult.GetDataAsync();, which may combined with new SetImageAsync(this IJSRuntime js,byte[] bin,string imgid) api to display the crop result.
You may find dotnet 6 sample here

Server-side Usage

Blazor.Cropper is designed to be a client side library. However, it can be used on server side blazor when setting PureCSharpProcessing="true".
Please note that using Blazor.Cropper on server side could consume remarkable amount of server resources(including bandwidth, cpu and memory).
Sample project

Quick Start

Only 4 steps to use Blazor.Cropper

Step0. Add nuget pkg

Install our nuget pkg at nuget.org. Add namespace to _import.razor:

@using Blazor.Cropper

Step1. Add script referrence

Then, you should paste following code into your index.html:

<script src="_content/Chronos.Blazor.Cropper/CropHelper.js"></script>

Step2. Add cropper

Just add cropper to your code. We recommend you to use it inside a modal card.

Example:

@* .... some code ...*@
<InputFile OnChange="OnInputFileChange"></InputFile>
<Cropper ImageFile="file" ></Cropper>
@* .... some code ...*@
    async Task OnInputFileChange(InputFileChangeEventArgs args)
    {
        file = args.File;
    }
@* .... some code ...*@
@* Example below shows how to bind Cropper with an InputFile component using InputId.
    Please note that you must set ImageFile property inorder to use gif crop or PureCSharpProcessing function.
    <InputFile id="input1"></InputFile>
    <Cropper InputId="input1" ></Cropper>
*@

Step3. Get result

To get the crop result, you need to get the reference of the Cropper, then call the Cropper.GetCropedResult() method.
Example:

@* .... some code ...*@
<Cropper ImageFile="file" @ref="cropper"></Cropper>
@* .... some code ...*@
@code{
    Cropper cropper;
    @* .... some code ...*@
    void GetCropResult()
    {
        var re = cropper.GetCropedResult();

        // in dotnet 6 or later
        var buffer = await re.GetDataAsync();
        // donot transfer bytes to base64 in dotnet 6.
        // if you want to display the crop result, use 
        // SetImageAsync(this IJSRuntime js,byte[] bin,string imgid) to
        // do the job



        // otherwise, get base64 directly
        // var base64 = await re.GetBase64Async();
    }
    @* .... some code ...*@
}

Api referrence

We have detailed xml comments on Cropper's properties & methods, simply read it while use it!
On the other hand, you can go to the sample project for usage examples.
To build it, simply clone it and run it in visual studio. The running result should be like this:

blazor.cropper's People

Contributors

chronostasys avatar codacy-badger avatar dnawrkshp avatar emuuu avatar heysaad avatar hounddog22030 avatar imgbotapp avatar teodoro-abdo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

blazor.cropper's Issues

NullReferenceException when calling Cropper.GetCropedResult()

Hi,

im gonna keep it short about what type of application I am building. The important part is that I am using a blazorise InputFile component to collect an IBrowserFile object to send to a Cropper component.

<InputFile id="cameraInput" type="file" accept="image/*" capture="camera" style="display: none;" 
   OnChange="HandleFileSelect"/>
           @if (_imageFile is not null)
             {
               <Cropper @ref="_cropperRef" ImageFile="_imageFile" InputId="cameraInput" CropperHeight="@(_windowHeight * 0.8)"> 
               </Cropper>
              }

The relevant variables like the IBrowserFile, _windowHeight or the reference objects are declared like this

    Cropper _cropperRef { get; set; }

    private IBrowserFile _imageFile;

    private double _windowHeight = 0;

    //more code

Now my problem is that as soon as the "save" function hits (where the cropped image gets processed) I get hit with a NullReferenceException when calling GetCropedResult().

public async Task Save()
    {
//some values get changed to enable different animations from the send-button etc. 
            StateHasChanged();

            if (_imageFile is not null)
            {
                var cropResult = await _cropperRef.GetCropedResult(); //this line throws the NullReferenceException

                byte[] bs = await cropResult.GetDataAsync();

                await SendImage(_imageFile, bs);
            }
    }

Screenshot 2023-06-13 112658

Through debugging I know that _cropperRef is not null I dont really know what could be causing the Exception to be thrown.
Could I be missing a value I need to assign before I can call GetCropedResult or are there any steps I need to take that havent already been taken?

Thanks in advance.

Uncaught (in promise) Error: No .NET call dispatcher has been set.

Whenever <script src="_content/Chronos.Blazor.Cropper/CropHelper.js"></script> is being referenced in index.html, it is throwing the following exception:

Uncaught (in promise) Error: No .NET call dispatcher has been set.
    at m (blazor.webassembly.js:1)
    at h (blazor.webassembly.js:1)
    at Object.e.invokeMethodAsync (blazor.webassembly.js:1)
    at HTMLDocument.<anonymous> (CropHelper.js:64)

Cannot crop some images

I loaded the image to the cropper and it does not allow to crop.

Example of image that's not working:
Me_Inicial

Feature Request: Provide metadata via properties or function call.

We would like to use this to record the metadata of the crop, instead of storing the cropped image. This will significantly reduce the size of storing the "cropped" images. We created a fork, but are some funkiness. Currently the worst funk is setting the crop box upon initialization if we have the metadata stored.

Our thoughts are it might be a better approach to request the maintainer to look into how to do this or at the least review a pull request and give some direction.

We'll post this pull request as well.

Thoughts?

TouchEnd bug

触屏结束事件看起来并没有被正常处理

ImageCroppedResult.GetBase64Async() is misleading.

ImageCroppedResult.GetBase64Async() is returning the web display image format not the pure base64 string. The following line in the GetBase64Async()

return $"data:{Format.DefaultMimeType};base64,{Convert.ToBase64String(buffer.Array, 0, (int)stream.Length)}";

should be

return Convert.ToBase64String(buffer.Array, 0, (int)stream.Length);

Displaying base64 string is not the responsibility of the library, it's the responsibility of the developer as follows:

PreviewImagePath = $"data:image/png;base64,{ImageBase64String}";

Crop locking option

Need crop locking option so that current crop size cannot be changed and it can only be moved. Look at the following image:

image

I would like to lock the current crop so that its size cannot be changed. It can only be moved inside the cropper.

Thank you.

Image Upload Issue .NET 6.0

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:

image

Here is my markup for the InputFile and Cropper

 <InputFile id="profileImageUploader" OnChange="OnInputFileChange" accept="image/jpg, image/jpeg, image/png" />

<Cropper InputId="profileImageUploader" @ref="profileImageCropper" ImageFile="file" CropperHeight="400"
    MaxCropedHeight="MaxImageHeight" MaxCropedWidth="MaxImageWidth" AspectRatio="1" RequireAspectRatio="true"
    InitCropHeight="50" InitCropWidth="50"
    IsCropLocked="false" @bind-Ratio="ratio" PureCSharpProcessing="true"
    IsImageLocked="true"></Cropper>

Here is where I'm setting the ImageFile

async Task OnInputFileChange(InputFileChangeEventArgs args)
{
    await JSRuntime.InvokeVoidAsync("console.log", DateTime.Now.ToString());
    var upload = false;
    file = args.File;
    StringContent content = null;
    var profilePictureString = string.Empty;

    //  Check file type
    var fileExtension = file.ContentType;
    if (new List<string>() { "image/jpg", "image/jpeg", "image/png" }.Contains(fileExtension) == false)
    {
        //  TODO: show error
        throw new InvalidDataException("wrong file type");
    }

    //  Check file dimensions
    if (file.Size > MaxFileSize)
    {
        //  TODO: show error
        throw new InvalidDataException("file too big");
    }
}

I tested this in the ServerSideCropperExample project that's available and confirmed that the issue exists there as well.

.NET 5.0
image

.NET 6.0
image

PureCSharpProcessing crashed with image *.ico

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Image cannot be loaded. Available decoders:
- JPEG : JpegDecoder
- TGA : TgaDecoder
- PNG : PngDecoder
- BMP : BmpDecoder
- GIF : GifDecoder

SixLabors.ImageSharp.UnknownImageFormatException: Image cannot be loaded. Available decoders:

  • JPEG : JpegDecoder

  • TGA : TgaDecoder

  • PNG : PngDecoder

  • BMP : BmpDecoder

  • GIF : GifDecoder

    at SixLabors.ImageSharp.Image.Load(Configuration configuration, Stream stream, IImageFormat& format)
    at SixLabors.ImageSharp.Image.Load(Configuration configuration, Byte[] data, IImageFormat& format)
    at SixLabors.ImageSharp.Image.Load(Byte[] data, IImageFormat& format)
    at Blazor.Cropper.Cropper.OnParametersSetAsync()
    at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
    at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
    at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

image

JS Interop exception occurs when choosing any pic.

Hello,
First, I would like to thank u for the great effort of Blazor cropper, it's very helpful tool. But, I want to share an exception that occurred when tried to use it. the exception is listed below.

Also some additional information for investigation:

  1. It was working fine on .Net5 but I upgraded to .Net6 and VS 22
  2. I use Chronos.Blazor.Cropper 1.2.5
  3. I use blazor server as shown in the exception.

Your help is much appreciated.
Have a great day!

Exception:
blazor.server.js:1
[2022-06-21T13:29:16.639Z] Error: Microsoft.JSInterop.JSException: Could not find 'rmCropperEventListeners' ('rmCropperEventListeners' was undefined).
Error: Could not find 'rmCropperEventListeners' ('rmCropperEventListeners' was undefined).
at https://localhost:44342/_framework/blazor.server.js:1:497
at Array.forEach ()
at i.findFunction (https://localhost:44342/_framework/blazor.server.js:1:465)
at E (https://localhost:44342/_framework/blazor.server.js:1:2606)
at https://localhost:44342/_framework/blazor.server.js:1:3494
at new Promise ()
at kt.beginInvokeJSFromDotNet (https://localhost:44342/_framework/blazor.server.js:1:3475)
at https://localhost:44342/_framework/blazor.server.js:1:72001
at Array.forEach ()
at kt._invokeClientMethod (https://localhost:44342/_framework/blazor.server.js:1:71987)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at Blazor.Cropper.Cropper.DisposeAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.g__GetHandledAsynchronousDisposalErrorsTask|64_0(Task result)

Why require InputFile?

Like the control, but could you update (or workaround) the requirement to have and InputFile control and use a base64/filestream as the datasource?

render-mode="Server" fails when when loading an image.

I created a simple razor component with your sample. I'm using server side blazor. The page renders, but when you click "choose file", the console reports the following error.

blazor.server.js:1 Uncaught (in promise) Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Blazor.Cropper.Cropper.get_WiderThanContainer()
at Blazor.Cropper.Cropper.GetI()
at Blazor.Cropper.Cropper.SizeChanged()
at Blazor.Cropper.Cropper.OnSizeChangeEnd(MouseEventArgs args)
at Blazor.Cropper.Cropper.b__134_2(MouseEventArgs args)
at Blazor.Cropper.Cropper.MouseUpCaller(MouseEventArgs args)
--- End of stack trace from previous location ---
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
at Object.endInvokeDotNetFromJS (http://localhost/ImpactWeb/_framework/blazor.server.js:1:70618)
at e. (http://localhost/ImpactWeb/_framework/blazor.server.js:10:48412)
at http://localhost/ImpactWeb/_framework/blazor.server.js:1:26442
at Array.forEach ()
at e.invokeClientMethod (http://localhost/ImpactWeb/_framework/blazor.server.js:1:26412)
at e.processIncomingData (http://localhost/ImpactWeb/_framework/blazor.server.js:1:24223)
at e.connection.onreceive (http://localhost/ImpactWeb/_framework/blazor.server.js:1:17308)
at e. (http://localhost/ImpactWeb/_framework/blazor.server.js:1:38200)
at http://localhost/ImpactWeb/_framework/blazor.server.js:1:35167
at Object.next (http://localhost/ImpactWeb/_framework/blazor.server.js:1:35272)

Question: Why can't I get to the left part of this image?

Been doing some more testing.

Steps To Reproduce:

  1. Edit CropperExample.razor (c#), change from ... to MaxCropedHeight="15000" MaxCropedWidth="15000"
  2. Run Sample Project
  3. Click Choose File
  4. Select File created from https://digital-assets.partshub.com/DVJP/460f3c4f0aba9.jpg
  5. Attempt to drag over to the leftmost part of the image (see above image file in step 4 in a separate browser tab)

Expected Result:

Able to drag to the leftmost part of the image in order to crop it.

Observed Result:

Unable to get to appx left 20% of the image.

This is reproducible from before the PR you accepted from me (commit b112ffe).

Croppers don't work as soon as there is another Cropper

I want to allow users to choose the differents crops of an image. Having croppers inside a loop makes the first cropper unusable and others can't load the image at all.

  • I tried with different Stream sources and copying the byte arrays to avoid any conflict.
  • It works if I display only one

Here's how I call the components

  @foreach (var (i, (w, h)) in ThumbnailSizes.WithIndex())
  {
      <div class="col-12">
          <Cropper @ref="croppers[i]" AspectRatio="@((double)w/h)" CropperHeight="150"
                   RequireAspectRatio="true" ImageFile="_cropperSource[i]"
                   InitCropHeight="150"
                   InitCropWidth="150"
                   AnimeGifEnable="true"
                   PureCSharpProcessing="true"
                   IsCropLocked="false"
                   IsImageLocked="false"></Cropper>
      </div>
  }

Here's how I set the source

  private static readonly (int Width, int Height)[] ThumbnailSizes = new[]
  {
      (1200, 630),
      (400, 230),
      (340, 500),
      (780, 300),
      (120, 90),
  };
  _cropperSource = ThumbnailSizes.Select(_ =>
  {
      var bytes = new byte[_newPictureFile.Bytes.Length];
      _newPictureFile.Bytes.CopyTo(bytes, 0);
      var ms = new MemoryStream(bytes);
      ms.Position = 0;
      return new StreamFile(ms);
  }).ToArray();

refactor: fix weird behaviors

Current cropper has some weird behaviors in conner cases. E.g. when mouse try to drag left-top side of the cropper box out of the image, the image will grow larger in the opposite direction.

wired image read failure

On my mac book pro, every time I tried to crop a gif file will fail on this line:

await resizedImageFile.OpenReadStream(100000000).ReadAsync(buffer);

Throwing following exception:
image

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: There is no file with ID 0. The file list may have changed.
      Error: There is no file with ID 0. The file list may have changed.
          at a (https://localhost:5001/_framework/blazor.webassembly.js:1:51328)
          at Object.readFileDataSharedMemory (https://localhost:5001/_framework/blazor.webassembly.js:1:53790)
          at Object.w [as invokeJSFromDotNet] (https://localhost:5001/_framework/blazor.webassembly.js:1:64032)
          at _mono_wasm_invoke_js_blazor (https://localhost:5001/_framework/dotnet.5.0.8.js:1:190800)
          at wasm_invoke_iiiiii (https://localhost:5001/_framework/dotnet.wasm:wasm-function[5611]:0xdda7f)
          at ves_pinvoke_method (https://localhost:5001/_framework/dotnet.wasm:wasm-function[5708]:0xdfb62)
          at interp_exec_method (https://localhost:5001/_framework/dotnet.wasm:wasm-function[2155]:0x44c08)
          at interp_runtime_invoke (https://localhost:5001/_framework/dotnet.wasm:wasm-function[7862]:0x12efff)
          at mono_jit_runtime_invoke (https://localhost:5001/_framework/dotnet.wasm:wasm-function[7347]:0x118e5f)
          at do_runtime_invoke (https://localhost:5001/_framework/dotnet.wasm:wasm-function[3304]:0x79d42)
Microsoft.JSInterop.JSException: There is no file with ID 0. The file list may have changed.
Error: There is no file with ID 0. The file list may have changed.
    at a (https://localhost:5001/_framework/blazor.webassembly.js:1:51328)
    at Object.readFileDataSharedMemory (https://localhost:5001/_framework/blazor.webassembly.js:1:53790)
    at Object.w [as invokeJSFromDotNet] (https://localhost:5001/_framework/blazor.webassembly.js:1:64032)
    at _mono_wasm_invoke_js_blazor (https://localhost:5001/_framework/dotnet.5.0.8.js:1:190800)
    at wasm_invoke_iiiiii (https://localhost:5001/_framework/dotnet.wasm:wasm-function[5611]:0xdda7f)
    at ves_pinvoke_method (https://localhost:5001/_framework/dotnet.wasm:wasm-function[5708]:0xdfb62)
    at interp_exec_method (https://localhost:5001/_framework/dotnet.wasm:wasm-function[2155]:0x44c08)
    at interp_runtime_invoke (https://localhost:5001/_framework/dotnet.wasm:wasm-function[7862]:0x12efff)
    at mono_jit_runtime_invoke (https://localhost:5001/_framework/dotnet.wasm:wasm-function[7347]:0x118e5f)
    at do_runtime_invoke (https://localhost:5001/_framework/dotnet.wasm:wasm-function[3304]:0x79d42)
   at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[ReadRequest,Object,Object,Int32](String identifier, ReadRequest arg0, Object arg1, Object arg2, Int64 targetInstanceId)
   at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[ReadRequest,Int32](String identifier, ReadRequest arg0)
   at Microsoft.AspNetCore.Components.Forms.SharedBrowserFileStream.CopyFileDataIntoBuffer(Int64 sourceOffset, Memory`1 destination, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Components.Forms.BrowserFileStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at Blazor.Cropper.Cropper.OnParametersSetAsync() in /Users/bobxli/src/Blazor.Cropper/Blazor.Cropper/Cropper.razor.cs:line 337
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

However, after more experiments, I found Blazor will throw the exactly same exception when I try to read the browser file directly after onchange event triggered by InputFile component

Error in cropping the picture

Hello,
I Have the same issue as issue #43
I'm using the Nuget package in my application so will not be able to add the work around (mentioned in the issue discussion) myself.
so my question is: When will the new version (1.2.6) will be released ?

[QUESTION] OffsetX and OffsetY

I can't get X, Y. I'm using as you have in your example, am I missing something?

do i have to use cropper.GetCropInfo()?

if I bind OffsetX and OffsetY to properties it is always 0

[QUESTION] Height and Width

Hello, is there a way to adjust the width so that the gray does not appear? or get the height and width of the original image from cropper.

[Feature] Lock image option.

We should add a lock image option that will lock the image so that it cannot be moved.

Design:

  1. A public property called IsImageLocked will be added to the Cropper component.
  2. Default value will be true, i.e image will be locked by default.

.NET 7 support

QUESTION Is it planned to release this package in .NET 7? Ut looks really awesome, and I would love to use it, but app i'm currently developing is in newest version of framework

Cropper - Object reference not set to an instance of an object.

Hello,
Thank you so much for the cropper. I used it in a project and it's pretty good. but, I have an issue when I try to upload photos it's frequent but not permenant issue. the exception is thrown as follows:
PS: (I use blazor server and I added the configuration for signalR on MaximumReceiveMessageSize = 10MB)

blazor.server.js:1 Uncaught (in promise) Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Blazor.Cropper.Cropper.get_WiderThanContainer()
at Blazor.Cropper.Cropper.GetI()
at Blazor.Cropper.Cropper.SizeChanged()
at Blazor.Cropper.Cropper.OnSizeChangeEnd(MouseEventArgs args)
at Blazor.Cropper.Cropper.b__134_2(MouseEventArgs args)
at Blazor.Cropper.Cropper.MouseUpCaller(MouseEventArgs args)
--- End of stack trace from previous location ---
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
at Object.endInvokeDotNetFromJS (https://localhost:44342/_framework/blazor.server.js:1:70618)
at e. (https://localhost:44342/_framework/blazor.server.js:10:48412)
at https://localhost:44342/_framework/blazor.server.js:1:26442
at Array.forEach ()
at e.invokeClientMethod (https://localhost:44342/_framework/blazor.server.js:1:26412)
at e.processIncomingData (https://localhost:44342/_framework/blazor.server.js:1:24223)
at e.connection.onreceive (https://localhost:44342/_framework/blazor.server.js:1:17308)
at WebSocket.i.onmessage (https://localhost:44342/_framework/blazor.server.js:1:46784)

Incompatible with .NET 7

For anyone finding this - you get this error:

CS0029	Cannot implicitly convert type 'Microsoft.AspNetCore.Components.ElementReference' to 'Blazor.Cropper.Cropper'	

Evidently this is a known problem:
dotnet/docs#35449

And it's number 5 on this list:
dotnet/razor#8718

Hopefully you won't waste an afternoon it. There is a mention of someone with a .NET 8 preview version having the same issue.

MissingMethodException: Method not found: 'SixLabors.ImageSharp.Formats.IImageFormat on Cropper.LoadImage()

With any ABP.IO Blazor Server project using version 7.0 (dotnet and ABP) I get the following error! I'm seem to be unable to fix it.

Error: System.MissingMethodException: Method not found: 'SixLabors.ImageSharp.Formats.IImageFormat SixLabors.ImageSharp.Formats.ImageFormatManager.FindFormatByFileExtension(System.String)'.
at Blazor.Cropper.Cropper.LoadImage(String ext, IBrowserFile resizedImageFile)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Blazor.Cropper.Cropper.LoadImage(String ext, IBrowserFile resizedImageFile)
at Blazor.Cropper.Cropper.OnParametersSetAsync() in C:\Users\brauerj\source\repos\MyReport7\dependencies\Blazor.Cropper\Blazor.Cropper\Cropper.razor.cs:line 376
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Any suggestions?

OnSizeChanged invalid identifier

After downloading the source I always get these 2 errors

C:\Users\manu_\Source\Repos\Blazor.Cropper\CropperSample\obj\Debug\net5.0\Razor\Pages\CropperExample.razor.g.cs(352,201,352,202): error CS1001: Identifier expected
1>C:\Users\manu_\Source\Repos\Blazor.Cropper\CropperSample\obj\Debug\net5.0\Razor\Pages\CropperExample.razor.g.cs(352,311,352,312): error CS1001: Identifier expected

for both projects CropperSample and CropperSampleV6 to fix it I always remove the OnSizeChanged event from the component, but in the end is not a fix.

Any idea why this error happens and how can it be fixed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.