filestack / filestack-js

Official Javascript SDK for the Filestack API and content ingestion system.
https://www.filestack.com
MIT License
206 stars 79 forks source link

onFileCropped not working in the pickerOptions #408

Closed JanStevens1112 closed 3 years ago

JanStevens1112 commented 3 years ago

I got an error " Uncaught Error: Invalid picker params" when I added onFileCropped option. Here is my react code snippet.

<PickerOverlay
            apikey={FILESTACK_API_KEY}
            pickerOptions={{
              accept: ['image/*', 'image/jpeg'],
              exposeOriginalFile: true,
              imageMax: imageMax || undefined,
              imageMin: imageMin || undefined,
              onFileCropped: checkImageSize,
              onFileSelected: checkImageSize,
              onFileUploadStarted: () => {},
              onFileUploadFinished: () => {},
              onFileUploadFailed: () => { },
              onClose: () => {}
            }}
            onSuccess={(res) => { }}
          />
maryfs commented 3 years ago

Hi @JanStevens1112 which filestack-js and react version?

JanStevens1112 commented 3 years ago

Hi, I'm working with filestack-react 4.0.0 now.

maryfs commented 3 years ago

@JanStevens1112 please check filestack-js version, and update to 3.21.0 and let me know.

JanStevens1112 commented 3 years ago

Hi, I'm using filestack-react @4.0.0 now.

On Wed, Jan 13, 2021 at 8:14 AM maryfs notifications@github.com wrote:

@JanStevens1112 https://github.com/JanStevens1112 please check filestack-js version, and update to 3.21.0 and let me know.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/filestack/filestack-js/issues/408#issuecomment-759440550, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRLKHYNPQOFEWCEXIAHUQ3SZWMEPANCNFSM4VLZRXUA .

maryfs commented 3 years ago

@JanStevens1112 yes, i know, but it uses filestack-js lib, please check in package.json which 'filestack-js' version is set .

mrshahrukh123 commented 3 years ago

Hi @maryfs I am using jspicker for web

included following file.

//static.filestackapi.com/filestack-js/3.x.x/filestack.min.js

I tried to change this //static.filestackapi.com/filestack-js/3.21.0/filestack.min.js

my options are

  `const options = {
          exposeOriginalFile: true,
          // errorsTimeout:1000,
          onUploadDone: updateForm,
          onFileSelected: validateFile,
          onFileCropped: validateFile,
          accept: ["image/jpeg", "image/png", "application/pdf"],
          fromSources: ["local_file_system", "instagram", "facebook"],
          uploadInBackground: false,

          transformations: {
              circle: false,
              rotate: true,
          },
          maxSize: 10485760, //Should limit to 10MB`

When I remove the onFileCropped option with callback it worked fine, but with the onFileCropped its not working.

please also note that I am adding other options after clicking a button.

options["transformations"]["crop"] = { aspectRatio: for_width / for_height, force: true, }; client.picker(options).open();

can you please tell me is there anything I need to do to make this working ? its showing me the error 'Uncaught Error: Invalid picker params'

Thanks

pcholuj commented 3 years ago

It should working in new release please check https://jsfiddle.net/pcholuj/54qhx8tL/2/