Load image from local system to Fabricjs canvas - Forum

Forum Navigation
You need to log in to create posts and topics.

Load image from local system to Fabricjs canvas

Hi luishp

I came across this page - https://www.html5rocks.com/en/tutorials/file/dndfiles/ which is interesting. How can we simulate the using form examples to load image from local system/device, and then insert them into the Container1 canvas ?

 

Hi @ronnie,
We are already using that method.
Note that the user must always select the file first using a File Input object.
You can not read any file from a local device directly.
To see a working sample:

  1.  Go to: https://aprendiendo.top
  2.  Click on "Editor" button
  3.  Click on the top menu image icon and select "Importar PNG, JPG o GIF"

Hi @luishp

Yeah.. I saw the fileinput object... but how do i load user-selected image to Container1? I tried the example in FabricDraw demo but it's using JSON... but nothing appears on the canvas

 

Hi @ronnie, as we are using FabricJS it's not easy but possible.
Take a look at the attached sample please.

Uploaded files:
  • You need to login to have access to uploads.

Hi @luishp,  it sure was not easy. Thank goodness you provide a sample demo that works fine. It's time for me to learn more JS, and compare the coding structure porting to VisualNeo Web.

Solution found. Case closed. New topic soon - rotation on Center. will post it in new topic.

Once again, thanks for the great demo. It works GREAT!!!