imgbb-image-uploader is a lightweight Node.js library for uploading images to the ImgBB API. It provides a simple and easy-to-use interface for uploading images and retrieving their URLs.
imgbb-image-uploader is a lightweight Node.js library for uploading images to the ImgBB API. It provides a simple and easy-to-use interface for uploading images and retrieving their URLs.
import imgbbUpload from "imgbb-image-uploader";
// Upload an image to ImgBB with additional options
imgbbUpload({
key: "your-api-key",// your imgbb api key
image: image, // image selected from the file input
expiration: 600,// 10 mins
name: 'name-of-the-image', // name of the image
})
.then((data) => {
console.log("Image uploaded to ImgBB:", data);
})
.catch((error) => {
console.error("Failed to upload image to ImgBB:", error);
});
These responses display all the image uploaded information in JSON format.
JSON the response will have headers status codes to allow you to easily notice if the request was OK or not. It will also output the status properties.
{
"data": {
"id": "2ndCYJK",
"title": "c1f64245afb2",
"url_viewer": "https://ibb.co/2ndCYJK",
"url": "https://i.ibb.co/w04Prt6/c1f64245afb2.gif",
"display_url": "https://i.ibb.co/98W13PY/c1f64245afb2.gif",
"width": "1",
"height": "1",
"size": "42",
"time": "1552042565",
"expiration": "0",
"image": {
"filename": "c1f64245afb2.gif",
"name": "c1f64245afb2",
"mime": "image/gif",
"extension": "gif",
"url": "https://i.ibb.co/w04Prt6/c1f64245afb2.gif"
},
"thumb": {
"filename": "c1f64245afb2.gif",
"name": "c1f64245afb2",
"mime": "image/gif",
"extension": "gif",
"url": "https://i.ibb.co/2ndCYJK/c1f64245afb2.gif"
},
"medium": {
"filename": "c1f64245afb2.gif",
"name": "c1f64245afb2",
"mime": "image/gif",
"extension": "gif",
"url": "https://i.ibb.co/98W13PY/c1f64245afb2.gif"
},
"delete_url": "https://ibb.co/2ndCYJK/670a7e48ddcb85ac340c717a41047e5c"
},
"success": true,
"status": 200
}
This library is licensed under the MIT License. See the LICENSE file for details.
Bug reports and pull requests are welcome on GitHub at https://github.com/sahilverma-dev/imgbb-image-uploader.