MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    图片过期机制

    开发交流
    2
    5
    463
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • X
      XDorz last edited by

      求解大佬:
      本人使用mirai的sdk包进行开发,使用时发现多次上传同一张图片所获得的imageId都是相同的,那么我每天进行的图片重新上传防止过期还有意义吗,直接保存下imageid以后使用是否都能成功显示?

      1 Reply Last reply Reply Quote 0
      • X
        XDorz last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • X
          XDorz last edited by

          public static Image upload(InputStream inputStream){
              Image image=null;
              ExternalResource externalResource=null;
              try {
                  externalResource=ExternalResource.create(inputStream);
                  image=ExternalResource.uploadAsImage(externalResource, BotFrameworkConfig.bot.getAsFriend());
              } catch (IOException e) {
                  log.error("图像上传流创建失败",e);
                  return null;
              }finally {
                  try {
                      if(inputStream!=null) inputStream.close();
                      if(externalResource!=null) externalResource.close();
                  } catch (IOException e) {
                      log.error("文件流无法关闭",e);
                      return null;
                  }
              }
              return image;
          }
          
          1 Reply Last reply Reply Quote 0
          • RainChan
            RainChan 摸鱼 last edited by

            有意义,因为腾讯会清除服务器上的图片,尽管id是相同的

            1 Reply Last reply Reply Quote 1
            • X
              XDorz last edited by

              了解!!!

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact