huseyinsade
huseyinsade

Reputation: 41

How do I constrain the height and width of an image in React Dropzone?

<Dropzone onDrop={_aaaa} minSize={1024} maxSize={3072000} maxFiles={5}>
          {({ getRootProps, getInputProps, isDragActive, isDragAccept, isDragReject }) => {
            return (
              <div {...getRootProps({ className: "yyyy" })}>
                <p className="xxxx">Drag the files to this area.</p>
                <input {...getInputProps()} />
              </div>
            );
          }}</Dropzone>

I just want to upload 400x500 photos.

Upvotes: 0

Views: 844

Answers (1)

huseyinsade
huseyinsade

Reputation: 41

While the image is onload, the function gives me the width and height values.

    var image = new Image();    
image.onload = function () {
    console.log('width', image.width);
    console.log('height', image.height);
};

Upvotes: 1

Related Questions