To correct the wrong impression about js, js can read local files, but it only needs to be triggered by user operations. For example, when uploading a picture, the user needs to click the "select picture" button.
The specific operation uses HTML5’s File API detailed explanation and demo
After the upload is completed, there is always a URL that can be accessed from the outside. This URL is returned to the browser, and then the browser loads the image, and uses the JS library that can cut the image. After the user operates the cut, X, Y, W, H continue to be transmitted to the background and you can use the picture library in the background for cropping.
Related recommendations: http://deepliquid.com/content/Jcrop.html https://www.npmjs.com/package/gm
To correct the wrong impression about js, js can read local files, but it only needs to be triggered by user operations. For example, when uploading a picture, the user needs to click the "select picture" button.
The specific operation uses HTML5’s File API
detailed explanation and demo
After the upload is completed, there is always a URL that can be accessed from the outside. This URL is returned to the browser, and then the browser loads the image, and uses the JS library that can cut the image. After the user operates the cut, X, Y, W, H continue to be transmitted to the background and you can use the picture library in the background for cropping.
Related recommendations:
http://deepliquid.com/content/Jcrop.html
https://www.npmjs.com/package/gm