imgbb image uploader
1.0.0
imgbb-image-uploader IMGBB API에 이미지를 업로드하기위한 가벼운 Node.js 라이브러리입니다. 이미지를 업로드하고 URL을 검색하기위한 간단하고 사용하기 쉬운 인터페이스를 제공합니다.
https://imgbb.com/
https://api.imgbb.com/
npm install imgbb-image-uploader import { imgbbUpload } from "imgbb-image-uploader" ;
imgbbUpload ( {
key : "your-api-key" , // your imgbb api key
image : image , // image selected from the file input
} )
. then ( ( data ) => {
console . log ( "Image uploaded to ImgBB:" , data ) ;
} )
. catch ( ( error ) => {
console . error ( "Failed to upload image to ImgBB:" , error ) ;
} ) ; 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 ) ;
} ) ;key : 인증에 사용할 IMGBB API 키.image : 파일 입력에서 선택한 이미지.name (선택 사항) : 이미지 파일의 이름입니다. 제공되지 않으면 Multipart/Form-Data로 파일을 업로드 할 때 이름이 자동으로 감지됩니다.expiration (선택 사항) : 업로드 된 이미지의 만료 시간, 초. 이 시간이 지나면 업로드 된 이미지가 자동으로 삭제됩니다.이 응답은 모든 이미지 업로드 된 정보를 JSON 형식으로 표시합니다.
JSON 응답에는 요청이 정상인지 아닌지 쉽게 알 수있는 헤더 상태 코드가 있습니다. 또한 상태 속성을 출력합니다
{
"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
}이 라이브러리는 MIT 라이센스에 따라 라이센스가 부여됩니다. 자세한 내용은 라이센스 파일을 참조하십시오.
https://github.com/sahilverma-dev/imgbb-image-uploader에서 버그 보고서 및 풀 요청은 환영합니다.