最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Deleting images in Imgbb via API - Stack Overflow

programmeradmin1浏览0评论

I'm using the imgbb API since it is very straightforward to use and quite cheap. The problem is that the documentation is very poor and it does not explain how to delete an image through the API. I want to be able to delete the photo from my server in the case something happens (example: if I delete a user). My server is written in node.js.

ps. Also the response object I get after uploading an image is this one:

{
  data: {
    id: 'c3VRs4x',
    title: 'client1-Bali',
    url_viewer: '',
    url: '.jpg',
    display_url: '.jpg',
    size: 60385,
    time: '1594835546',
    expiration: '0',
    image: {
      filename: 'client1-Bali.jpg',
      name: 'client1-Bali',
      mime: 'image/jpeg',
      extension: 'jpg',
      url: '.jpg'
    },
    thumb: {
      filename: 'client1-Bali.jpg',
      name: 'client1-Bali',
      mime: 'image/jpeg',
      extension: 'jpg',
      url: '.jpg'
    },
    medium: {
      filename: 'client1-Bali.jpg',
      name: 'client1-Bali',
      mime: 'image/jpeg',
      extension: 'jpg',
      url: '.jpg'
    },
    delete_url: ''
  },
  success: true,
  status: 200
}

Edit: Here is the link to the imgbb API documentation: /

I'm using the imgbb API since it is very straightforward to use and quite cheap. The problem is that the documentation is very poor and it does not explain how to delete an image through the API. I want to be able to delete the photo from my server in the case something happens (example: if I delete a user). My server is written in node.js.

ps. Also the response object I get after uploading an image is this one:

{
  data: {
    id: 'c3VRs4x',
    title: 'client1-Bali',
    url_viewer: 'https://ibb.co/c3VRs4x',
    url: 'https://i.ibb.co/Pj0JVqt/client1-Bali.jpg',
    display_url: 'https://i.ibb.co/1QjB4Fb/client1-Bali.jpg',
    size: 60385,
    time: '1594835546',
    expiration: '0',
    image: {
      filename: 'client1-Bali.jpg',
      name: 'client1-Bali',
      mime: 'image/jpeg',
      extension: 'jpg',
      url: 'https://i.ibb.co/Pj0JVqt/client1-Bali.jpg'
    },
    thumb: {
      filename: 'client1-Bali.jpg',
      name: 'client1-Bali',
      mime: 'image/jpeg',
      extension: 'jpg',
      url: 'https://i.ibb.co/c3VRs4x/client1-Bali.jpg'
    },
    medium: {
      filename: 'client1-Bali.jpg',
      name: 'client1-Bali',
      mime: 'image/jpeg',
      extension: 'jpg',
      url: 'https://i.ibb.co/1QjB4Fb/client1-Bali.jpg'
    },
    delete_url: 'https://ibb.co/c3VRs4x/b3072de2f5287a39f81c7dec3cd8a236'
  },
  success: true,
  status: 200
}

Edit: Here is the link to the imgbb API documentation: https://api.imgbb./

Share edited Dec 17, 2023 at 18:26 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Jul 15, 2020 at 18:10 Jose Andres Montes EspinozaJose Andres Montes Espinoza 1071 silver badge9 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

Imgbb does not allow you to delete images. I just tried going to the delete URL to delete the image and the image got deleted on that page but not on the other links in the JSON. If the functionality is not implemented on the site itself there is no use trying on the API. If they did have the functionality to entirely delete an image then you could have used web scraping to press the buttons.

The problem is that you're using the free version, and only by paying for their plans do you get full access to the API.

发布评论

评论列表(0)

  1. 暂无评论