Closed Nau077 closed 4 years ago
This module is explicitly for use with node.js. It does not work in the browser. If you want to use smartcrop in the browser, just use the base library. Based on your code it's impossible to say what is going wrong. What is fairly clear from the stack trace is that you don't even reach smartcrop-sharp. You seem to pass request an argument which it doesn't like. Also img_crop will always be undefined since applySmartCrop doesn't return any value. I'm not sure what you want to achieve with img_crop.
I have valid url for src variable: https://rixtrema.net/exeimages/exeimages_200/ba/6b/ba6b3e99300519d912511ea36c687f77.jpg
use it inside your code
and get
Error: Invalid URI "/" at Request.init (/home/roman/web/img-neiro-full/server/node_modules/request/request.js:273:31) at new Request (/home/roman/web/img-neiro-full/server/node_modules/request/request.js:127:8) at request (/home/roman/web/img-neiro-full/server/node_modules/request/index.js:53:10) at applySmartCrop (/home/roman/web/img-neiro-full/server/controller/cropImages.js:9:7) at makeImgCrop (/home/roman/web/img-neiro-full/server/controller/cropImages.js:22:22) at Layer.handle [as handle_request] (/home/roman/web/img-neiro-full/server/node_modules/express/lib/router/layer.js:95:5) at next (/home/roman/web/img-neiro-full/server/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/home/roman/web/img-neiro-full/server/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/home/roman/web/img-neiro-full/server/node_modules/express/lib/router/layer.js:95:5) at /home/roman/web/img-neiro-full/server/node_modules/express/lib/router/index.js:281:22
==== Finally I dont understand at all how to use your library, lack of examples - only nice images dont help understand how to use it. And I dont understand what output from function applySmartCrop() I will get, if all go with success. base64/something else?
Is it possible to use smarcrop only on client side or it is espessially server desision with this module (smartcrop-sharp)?