@Test public void testAddImage() throws IOException { InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("media/borball.jpg"); Material material = Materials.defaultMaterials().addImage(inputStream, "borball.jpg"); Assert.assertNotNull(material); String mediaId = material.getMediaId(); String url = material.getUrl(); System.out.println("图片ID:" + mediaId); System.out.println("图片URL:" + url); InputStream is = Materials.defaultMaterials().getImage(mediaId); FileUtils.copyInputStreamToFile(is, new File("borball.jpg")); }
public Material addImage(InputStream inputStream, String fileName) { return upload(MediaType.image, inputStream, fileName); }
Materials { public Material addImage(InputStream inputStream, String fileName) { return upload(MediaType.image, inputStream, fileName); } }
Materials { public Material addImage(InputStream inputStream, String fileName) { return upload(MediaType.image, inputStream, fileName); }  }
Materials { public Material addImage(InputStream inputStream, String fileName) { return upload(MediaType.image, inputStream, fileName); }  static Materials defaultMaterials(); static Materials with(AppSetting appSetting); void setWxClient(WxClient wxClient); String addMpNewsImage(InputStream inputStream, String fileName); String addMpNews(MpNews mpNews); MpNews getMpNews(String mediaId); void updateMpNews(String mediaId, int index, MpArticle article); Material addVoice(InputStream inputStream, String fileName); InputStream getVoice(String mediaId); Material addImage(InputStream inputStream, String fileName); InputStream getImage(String mediaId); Material addThumb(InputStream inputStream, String fileName); InputStream getThumb(String mediaId); Material addVideo(InputStream inputStream, String fileName, String title, String description); Video getVideo(String mediaId); Counts count(); MaterialPagination list(MediaType mediaType, int offset, int count); MpNewsPagination listMpNews(int offset, int count); void delete(String mediaId); }
Materials { public Material addImage(InputStream inputStream, String fileName) { return upload(MediaType.image, inputStream, fileName); }  static Materials defaultMaterials(); static Materials with(AppSetting appSetting); void setWxClient(WxClient wxClient); String addMpNewsImage(InputStream inputStream, String fileName); String addMpNews(MpNews mpNews); MpNews getMpNews(String mediaId); void updateMpNews(String mediaId, int index, MpArticle article); Material addVoice(InputStream inputStream, String fileName); InputStream getVoice(String mediaId); Material addImage(InputStream inputStream, String fileName); InputStream getImage(String mediaId); Material addThumb(InputStream inputStream, String fileName); InputStream getThumb(String mediaId); Material addVideo(InputStream inputStream, String fileName, String title, String description); Video getVideo(String mediaId); Counts count(); MaterialPagination list(MediaType mediaType, int offset, int count); MpNewsPagination listMpNews(int offset, int count); void delete(String mediaId);  }