Image

Image

Image class, used to upload image to sxcu.net

Constructor

# new Image(url, token)

Construct the base of the image. The upload URL and the upload token.
Parameters:
Name Type Default Description
url String https://sxcu.net/upload/ The upload url of the image, defaults to https:/sxcu.net/upload/.
token String The upload token of the domain, only needed if the domain is private.
Source:

Methods

# attachFile(file) → {Image}

Attach the file you want to upload.
Parameters:
Name Type Description
file String The path of the file you want to upload.
Source:
Returns:
This instance of the class.
Type
Image

# setCollection(collection) → {Image}

Parameters:
Name Type Description
collection Collection The colllection you want to upload the image to.
Source:
Returns:
This instance of the class.
Type
Image

# setNoEmbed() → {Image}

Running this method will return a direct URL to the uploaded image, instead of a dedicated page.
Source:
Returns:
This instance of the class.
Type
Image

# setOgProperties(og_props) → {Image}

Sets the OpenGraph properties of the file.
Parameters:
Name Type Description
og_props ImageOgProperties The OpenGraph properties you want to add to the upload.
Source:
Returns:
This instance of the class.
Type
Image

# upload() → {Promise.<(UploadedImage|ImageUploadError)>}

Upload the image with all the configurations done.
Source:
Returns:
Its a promise, will return a instance of UploadedImage class on success.
Type
Promise.<(UploadedImage|ImageUploadError)>