Sanford-Tek
Sanford-Tek

Reputation: 3

antd-img-crop - Skip crop/resize if the image being uploaded in .svg format

I have implemented antd-img-crop on image upload for my react app. I want to skip the crop/resize if the image file selected is .svg format as the svg file gets corrupted after uploading.

Upvotes: 0

Views: 1205

Answers (1)

Aftab
Aftab

Reputation: 11

beforeCrop prop of ImgCrop component give you access to the file object, using which you can validate the type of file that's being uploaded.

<ImgCrop beforeCrop={file => console.log(file)}>
    <Upload>+ Add image</Upload>
</ImgCrop>

Upvotes: 1

Related Questions