image-salon-sdk
v1.0.35
Published
library to upload images
Downloads
362
Readme
image-salon-sdk
library to upload images
Installation
npm install image-salon-sdk
import ImageSalon, { ImageUploadResponse } from "image-salon-sdk";
const imageSalon = new ImageSalon({
handleUpload: () => {
handleImageUpload();
},
mode: "development",
accessToken: `${accessToken}`,
parentContainerId: "example",
buttonProps: {
// optional
buttonText: "Upload",
...
},
});
const handleImageUpload = () => {
imageSalon._upload().then((res: ImageUploadResponse[]) => {
// rest of the code
});
};
return <div id="example" />;
parameters for ImageUpload class
handleUpload: () => void; //callback to handle upload event on click.
parentContainerId: string; //id of the container where you want to load message snippet.
mode: "production" || "development";
accessToken: string;
endPoint?: string; // custom endpoint- ignores mode
buttonProps?: {
buttonText?: string;
buttonStyle?: object; // style css object
buttonIcon?: string; // pass svg as string
buttonClass?: string;
}
upload response
key: string;
name: string;
folderName: string;
nestedFolderName: string;
url: string;
thumborUrl: string;
proxyUrl: string;
type: number;
metadata: {
height: number;
width: number;
backgroundColor: string;
aspectRatio: number;
}